mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-14 14:57:00 +10:00
fixes #2539, show all possible font weight options for local fonts or unknown fontFamily
This commit is contained in:
@@ -63,9 +63,17 @@ type FontWeightComboboxProps = Omit<MultipleComboboxProps, "options"> & { fontFa
|
||||
export function FontWeightCombobox({ fontFamily, ...props }: FontWeightComboboxProps) {
|
||||
const options = useMemo(() => {
|
||||
const fontData = webFontMap.get(fontFamily);
|
||||
if (!fontData || !Array.isArray(fontData.weights)) return [];
|
||||
|
||||
return fontData.weights.map((variant: string) => ({
|
||||
let weights: string[] = [];
|
||||
|
||||
if (!fontData || !Array.isArray(fontData.weights)) {
|
||||
// Provide all possible options for local fonts or unknown fontFamily
|
||||
weights = ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
|
||||
} else {
|
||||
weights = fontData.weights as string[];
|
||||
}
|
||||
|
||||
return weights.map((variant: string) => ({
|
||||
value: variant,
|
||||
label: variant,
|
||||
keywords: [variant],
|
||||
|
||||
@@ -117,11 +117,10 @@ function Combobox<TValue extends string | number = string>({
|
||||
|
||||
<PopoverContent
|
||||
align="start"
|
||||
aria-disabled={disabled}
|
||||
tabIndex={disabled ? -1 : undefined}
|
||||
className={cn("min-w-[200px] p-0", className, disabled && "pointer-events-none select-none opacity-60")}
|
||||
{...props}
|
||||
// Hide popover content visually and functionally if disabled (prevent tab focus etc)
|
||||
tabIndex={disabled ? -1 : undefined}
|
||||
aria-disabled={disabled}
|
||||
>
|
||||
<Command>
|
||||
<CommandInput placeholder={searchPlaceholder} disabled={disabled} />
|
||||
|
||||
Reference in New Issue
Block a user