mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Some checks failed
Auto release excalidraw next / Auto-release-excalidraw-next (push) Failing after 2m36s
Build Docker image / build-docker (push) Failing after 6s
Cancel previous runs / cancel (push) Failing after 1s
Publish Docker / publish-docker (push) Failing after 31s
New Sentry production release / sentry (push) Failing after 2m3s
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import * as Popover from "@radix-ui/react-popover";
|
|
import { useMemo } from "react";
|
|
|
|
import type { FontFamilyValues } from "@excalidraw/element/types";
|
|
|
|
import { t } from "../../i18n";
|
|
import { ButtonIcon } from "../ButtonIcon";
|
|
import { TextIcon } from "../icons";
|
|
|
|
import { isDefaultFont } from "./FontPicker";
|
|
|
|
interface FontPickerTriggerProps {
|
|
selectedFontFamily: FontFamilyValues | null;
|
|
}
|
|
|
|
export const FontPickerTrigger = ({
|
|
selectedFontFamily,
|
|
}: FontPickerTriggerProps) => {
|
|
const isTriggerActive = useMemo(
|
|
() => Boolean(selectedFontFamily && !isDefaultFont(selectedFontFamily)),
|
|
[selectedFontFamily],
|
|
);
|
|
|
|
return (
|
|
<Popover.Trigger asChild>
|
|
{/* Empty div as trigger so it's stretched 100% due to different button sizes */}
|
|
<div>
|
|
<ButtonIcon
|
|
standalone
|
|
icon={TextIcon}
|
|
title={t("labels.showFonts")}
|
|
className="properties-trigger"
|
|
testId={"font-family-show-fonts"}
|
|
active={isTriggerActive}
|
|
// no-op
|
|
onClick={() => {}}
|
|
/>
|
|
</div>
|
|
</Popover.Trigger>
|
|
);
|
|
};
|