Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
apply the first available weight when current weight isn't supported by the custom font
Oleg Isonen65f916ddd1e7
diff --git a/apps/designer/app/designer/features/style-panel/controls/font-weight/font-weight-control.tsx b/apps/designer/app/designer/features/style-panel/controls/font-weight/font-weight-control.tsxindex bf30d49346..af43e55e57 100644--- a/apps/designer/app/designer/features/style-panel/controls/font-weight/font-weight-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/font-weight/font-weight-control.tsx@@ -56,9 +56,11 @@ const useLabels = ();const selectedLabel = useMemo(() => {- const selectedOption = availableFontWeights.find(- (option) => option.weight === currentWeight- );+ const selectedOption =+ availableFontWeights.find((option) => option.weight === currentWeight) ??+ // In case available weights a custom font supports does not include the current weight,+ // we show the first available weight.+ availableFontWeights[0];return selectedOption?.label;}, [currentWeight, availableFontWeights]);