import React, { useCallback, useState } from 'react'; import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@100mslive/react-icons'; import { LayoutMode, LayoutModeIconMapping, LayoutModeKeys } from './Settings/LayoutSettings'; import { Flex } from '../../Layout'; import { Popover } from '../../Popover'; import { Text } from '../../Text'; // @ts-ignore: No implicit Any import { useSetUiSettings } from '../components/AppData/useUISettings'; import { UI_SETTINGS } from '../common/constants'; export const LayoutModeSelector = () => { const [open, setOpen] = useState(false); const [layoutMode, setLayoutMode] = useSetUiSettings(UI_SETTINGS.layoutMode); const updateLayoutMode = useCallback( (value: string) => { setLayoutMode(value); setOpen(false); }, [setLayoutMode, setOpen], ); return ( svg': { w: '$9', h: '$9', }, }} > {LayoutModeIconMapping[layoutMode as LayoutModeKeys]} {layoutMode} {open ? : } {Object.keys(LayoutMode).map(key => { const value = LayoutMode[key as LayoutModeKeys]; return ( updateLayoutMode(value)} align="center" css={{ gap: '$4', borderBottom: '1px solid $border_bright', p: '$8', '&:hover': { cursor: 'pointer', bg: '$surface_bright', }, '&:focus-visible': { bg: '$surface_bright', }, }} > svg': { w: '$9', h: '$9', }, }} > {LayoutModeIconMapping[value]} {value} {value === layoutMode ? : null} ); })} ); };