import { SharedStyle, StyleProp, preventDefault } from '@bigbluebutton/editor' import { Trigger } from '@radix-ui/react-dropdown-menu' import * as React from 'react' import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey' import { useTranslation } from '../../hooks/useTranslation/useTranslation' import { TLUiIconType } from '../../icon-types' import { Button } from '../primitives/Button' import * as DropdownMenu from '../primitives/DropdownMenu' import { StyleValuesForUi } from './styles' interface DoubleDropdownPickerProps { uiTypeA: string uiTypeB: string label: TLUiTranslationKey | Exclude labelA: TLUiTranslationKey | Exclude labelB: TLUiTranslationKey | Exclude itemsA: StyleValuesForUi itemsB: StyleValuesForUi styleA: StyleProp styleB: StyleProp valueA: SharedStyle valueB: SharedStyle onValueChange: (style: StyleProp, value: T, squashing: boolean) => void } export const DoubleDropdownPicker = React.memo(function DoubleDropdownPicker({ label, uiTypeA, uiTypeB, labelA, labelB, itemsA, itemsB, styleA, styleB, valueA, valueB, onValueChange, }: DoubleDropdownPickerProps) { const msg = useTranslation() const iconA = React.useMemo( () => itemsA.find((item) => valueA.type === 'shared' && valueA.value === item.value)?.icon ?? 'mixed', [itemsA, valueA] ) const iconB = React.useMemo( () => itemsB.find((item) => valueB.type === 'shared' && valueB.value === item.value)?.icon ?? 'mixed', [itemsB, valueB] ) if (valueA === undefined && valueB === undefined) return null return (
{msg(label)}
preventDefault(e)} >
) })