feat: allow the hiding of default fonts

This commit is contained in:
Ryan Di
2025-07-16 17:48:12 +10:00
parent 580622709d
commit 00c6599a71

View File

@@ -58,6 +58,7 @@ interface FontPickerProps {
onHover: (fontFamily: FontFamilyValues) => void; onHover: (fontFamily: FontFamilyValues) => void;
onLeave: () => void; onLeave: () => void;
onPopupChange: (open: boolean) => void; onPopupChange: (open: boolean) => void;
compactMode?: boolean;
} }
export const FontPicker = React.memo( export const FontPicker = React.memo(
@@ -69,6 +70,7 @@ export const FontPicker = React.memo(
onHover, onHover,
onLeave, onLeave,
onPopupChange, onPopupChange,
compactMode = false,
}: FontPickerProps) => { }: FontPickerProps) => {
const defaultFonts = useMemo(() => DEFAULT_FONTS, []); const defaultFonts = useMemo(() => DEFAULT_FONTS, []);
const onSelectCallback = useCallback( const onSelectCallback = useCallback(
@@ -82,6 +84,7 @@ export const FontPicker = React.memo(
return ( return (
<div role="dialog" aria-modal="true" className="FontPicker__container"> <div role="dialog" aria-modal="true" className="FontPicker__container">
{!compactMode && (
<div className="buttonList"> <div className="buttonList">
<RadioSelection<FontFamilyValues | false> <RadioSelection<FontFamilyValues | false>
type="button" type="button"
@@ -90,7 +93,8 @@ export const FontPicker = React.memo(
onClick={onSelectCallback} onClick={onSelectCallback}
/> />
</div> </div>
<ButtonSeparator /> )}
{!compactMode && <ButtonSeparator />}
<Popover.Root open={isOpened} onOpenChange={onPopupChange}> <Popover.Root open={isOpened} onOpenChange={onPopupChange}>
<FontPickerTrigger selectedFontFamily={selectedFontFamily} /> <FontPickerTrigger selectedFontFamily={selectedFontFamily} />
{isOpened && ( {isOpened && (