Skip to content

Commit

Permalink
Update font-call.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Apr 21, 2024
1 parent 66875bf commit eb97d27
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/font-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ export function familyStyle({
previewName: string;
subset: string;
}): string {
let style = `font-family: '${family}';`;
const styleParts = [`font-family: '${family}'`];
if (rtlSubsets.includes(subset) && family !== previewName) {
style += "direction: rtl;";
styleParts.push("direction: rtl");
}
if (selectedVariant.includes("italic")) {
style += "font-style: italic;";
styleParts.push("font-style: italic");
}
// get variant number from selectedVariant
const variantNumber = selectedVariant.match(/\d+/g);
if (variantNumber && variantNumber[0]) {
style += `font-weight: ${variantNumber[0]};`;
styleParts.push(`font-weight: ${variantNumber[0]}`);
}
return style;
return `${styleParts.join(";")};`;
}

0 comments on commit eb97d27

Please sign in to comment.