💄(frontend) use dark theme for menus in the videoconference
Inspired by GMeet. Actually, these menus are horrible to work with. This is clearly some technical debt. I fixed the styles, but not the code, we should refactor them to make easy to chose between two variant, a light and a dark one.
This commit is contained in:
committed by
aleb_the_flash
parent
a06daad33d
commit
6587863afb
@@ -8,7 +8,7 @@ export const OptionsButton = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Menu>
|
<Menu variant="dark">
|
||||||
<Button
|
<Button
|
||||||
square
|
square
|
||||||
variant="primaryDark"
|
variant="primaryDark"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const OptionsMenuItems = () => {
|
|||||||
<MenuSection>
|
<MenuSection>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onAction={() => toggleEffects()}
|
onAction={() => toggleEffects()}
|
||||||
className={menuRecipe({ icon: true }).item}
|
className={menuRecipe({ icon: true, variant: 'dark' }).item}
|
||||||
>
|
>
|
||||||
<RiAccountBoxLine size={20} />
|
<RiAccountBoxLine size={20} />
|
||||||
{t('effects')}
|
{t('effects')}
|
||||||
@@ -37,13 +37,13 @@ export const OptionsMenuItems = () => {
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
href={GRIST_FORM}
|
href={GRIST_FORM}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className={menuRecipe({ icon: true }).item}
|
className={menuRecipe({ icon: true, variant: 'dark' }).item}
|
||||||
>
|
>
|
||||||
<RiMegaphoneLine size={20} />
|
<RiMegaphoneLine size={20} />
|
||||||
{t('feedback')}
|
{t('feedback')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
className={menuRecipe({ icon: true }).item}
|
className={menuRecipe({ icon: true, variant: 'dark' }).item}
|
||||||
onAction={() => setDialogOpen(true)}
|
onAction={() => setDialogOpen(true)}
|
||||||
>
|
>
|
||||||
<RiSettings3Line size={20} />
|
<RiSettings3Line size={20} />
|
||||||
|
|||||||
@@ -67,10 +67,12 @@ type SelectToggleDeviceProps<T extends ToggleSource> =
|
|||||||
UseTrackToggleProps<T> & {
|
UseTrackToggleProps<T> & {
|
||||||
onActiveDeviceChange: (deviceId: string) => void
|
onActiveDeviceChange: (deviceId: string) => void
|
||||||
source: SelectToggleSource
|
source: SelectToggleSource
|
||||||
|
variant?: 'dark' | 'light'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SelectToggleDevice = <T extends ToggleSource>({
|
export const SelectToggleDevice = <T extends ToggleSource>({
|
||||||
onActiveDeviceChange,
|
onActiveDeviceChange,
|
||||||
|
variant = 'light',
|
||||||
...props
|
...props
|
||||||
}: SelectToggleDeviceProps<T>) => {
|
}: SelectToggleDeviceProps<T>) => {
|
||||||
const config = selectToggleDeviceConfig[props.source]
|
const config = selectToggleDeviceConfig[props.source]
|
||||||
@@ -93,7 +95,7 @@ export const SelectToggleDevice = <T extends ToggleSource>({
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<ToggleDevice {...trackProps} config={config} />
|
<ToggleDevice {...trackProps} config={config} />
|
||||||
<Menu>
|
<Menu variant={variant}>
|
||||||
<Button
|
<Button
|
||||||
tooltip={selectLabel}
|
tooltip={selectLabel}
|
||||||
aria-label={selectLabel}
|
aria-label={selectLabel}
|
||||||
@@ -113,6 +115,7 @@ export const SelectToggleDevice = <T extends ToggleSource>({
|
|||||||
setActiveMediaDevice(value as string)
|
setActiveMediaDevice(value as string)
|
||||||
onActiveDeviceChange(value as string)
|
onActiveDeviceChange(value as string)
|
||||||
}}
|
}}
|
||||||
|
variant={variant}
|
||||||
/>
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export function DesktopControlBar({
|
|||||||
onActiveDeviceChange={(deviceId) =>
|
onActiveDeviceChange={(deviceId) =>
|
||||||
saveAudioInputDeviceId(deviceId ?? '')
|
saveAudioInputDeviceId(deviceId ?? '')
|
||||||
}
|
}
|
||||||
|
variant="dark"
|
||||||
/>
|
/>
|
||||||
<SelectToggleDevice
|
<SelectToggleDevice
|
||||||
source={Track.Source.Camera}
|
source={Track.Source.Camera}
|
||||||
@@ -72,6 +73,7 @@ export function DesktopControlBar({
|
|||||||
onActiveDeviceChange={(deviceId) =>
|
onActiveDeviceChange={(deviceId) =>
|
||||||
saveVideoInputDeviceId(deviceId ?? '')
|
saveVideoInputDeviceId(deviceId ?? '')
|
||||||
}
|
}
|
||||||
|
variant="dark"
|
||||||
/>
|
/>
|
||||||
{browserSupportsScreenSharing && (
|
{browserSupportsScreenSharing && (
|
||||||
<ScreenShareToggle
|
<ScreenShareToggle
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const box = cva({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
variant: {
|
variant: {
|
||||||
default: {
|
light: {
|
||||||
borderWidth: '1px',
|
borderWidth: '1px',
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
borderColor: 'box.border',
|
borderColor: 'box.border',
|
||||||
@@ -46,6 +46,10 @@ const box = cva({
|
|||||||
backgroundColor: 'box.bg',
|
backgroundColor: 'box.bg',
|
||||||
color: 'control.text',
|
color: 'control.text',
|
||||||
},
|
},
|
||||||
|
dark: {
|
||||||
|
backgroundColor: 'primaryDark.50',
|
||||||
|
borderColord: 'primaryDark.50',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
default: {
|
default: {
|
||||||
@@ -57,7 +61,7 @@ const box = cva({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
variant: 'default',
|
variant: 'light',
|
||||||
size: 'default',
|
size: 'default',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,15 +8,17 @@ import { Box } from './Box'
|
|||||||
*/
|
*/
|
||||||
export const Menu = ({
|
export const Menu = ({
|
||||||
children,
|
children,
|
||||||
|
variant = 'light',
|
||||||
}: {
|
}: {
|
||||||
children: [trigger: ReactNode, menu: ReactNode]
|
children: [trigger: ReactNode, menu: ReactNode]
|
||||||
|
variant?: 'dark' | 'light'
|
||||||
}) => {
|
}) => {
|
||||||
const [trigger, menu] = children
|
const [trigger, menu] = children
|
||||||
return (
|
return (
|
||||||
<MenuTrigger>
|
<MenuTrigger>
|
||||||
{trigger}
|
{trigger}
|
||||||
<StyledPopover>
|
<StyledPopover>
|
||||||
<Box size="sm" type="popover">
|
<Box size="sm" type="popover" variant={variant}>
|
||||||
{menu}
|
{menu}
|
||||||
</Box>
|
</Box>
|
||||||
</StyledPopover>
|
</StyledPopover>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const MenuList = <T extends string | number = string>({
|
|||||||
onAction,
|
onAction,
|
||||||
selectedItem,
|
selectedItem,
|
||||||
items = [],
|
items = [],
|
||||||
|
variant = 'light',
|
||||||
...menuProps
|
...menuProps
|
||||||
}: {
|
}: {
|
||||||
onAction: (key: T) => void
|
onAction: (key: T) => void
|
||||||
@@ -18,7 +19,11 @@ export const MenuList = <T extends string | number = string>({
|
|||||||
} & MenuProps<unknown> &
|
} & MenuProps<unknown> &
|
||||||
RecipeVariantProps<typeof menuRecipe>) => {
|
RecipeVariantProps<typeof menuRecipe>) => {
|
||||||
const [variantProps] = menuRecipe.splitVariantProps(menuProps)
|
const [variantProps] = menuRecipe.splitVariantProps(menuProps)
|
||||||
const classes = menuRecipe({ extraPadding: true, ...variantProps })
|
const classes = menuRecipe({
|
||||||
|
extraPadding: true,
|
||||||
|
variant: variant,
|
||||||
|
...variantProps,
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
selectionMode={selectedItem !== undefined ? 'single' : undefined}
|
selectionMode={selectedItem !== undefined ? 'single' : undefined}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Separator as RACSeparator } from 'react-aria-components'
|
|||||||
export const Separator = styled(RACSeparator, {
|
export const Separator = styled(RACSeparator, {
|
||||||
base: {
|
base: {
|
||||||
height: '1px',
|
height: '1px',
|
||||||
background: 'gray.400',
|
background: 'primaryDark.200',
|
||||||
margin: '4px 0',
|
margin: '4px 0',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -46,7 +46,11 @@ export const menuRecipe = sva({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dark: {},
|
dark: {
|
||||||
|
item: {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
extraPadding: {
|
extraPadding: {
|
||||||
true: {
|
true: {
|
||||||
@@ -67,6 +71,6 @@ export const menuRecipe = sva({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
variant: 'dark',
|
variant: 'light',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user