Skip to content

Commit

Permalink
fix(website): map categories to font-family for install (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuhito committed Feb 11, 2024
1 parent 60ee16b commit 75a0da4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions website/app/components/preview/Install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ import { CarbonAd } from '../CarbonAd';
import { InfoWrapper } from './Info';
import classes from './Install.module.css';

const categoryMap: Record<string, string> = {
'sans-serif': 'sans-serif',
serif: 'serif',
monospace: 'monospace',
handwriting: 'cursive',
display: 'system-ui',
};

interface InstallProps {
metadata: Metadata;
variable?: VariableData;
Expand Down Expand Up @@ -129,7 +137,9 @@ const Variable = ({ metadata, variable }: InstallProps) => {
</Text>
<Code language="css">
{`body {
font-family: '${metadata.family} Variable', sans-serif;
font-family: '${metadata.family} Variable', ${
categoryMap[metadata.category] ?? 'sans-serif'
};
}`}
</Code>
</>
Expand Down Expand Up @@ -223,7 +233,9 @@ const Static = ({ metadata }: InstallProps) => {
</Text>
<Code language="css">
{`body {
font-family: '${metadata.family}', sans-serif;
font-family: '${metadata.family}', ${
categoryMap[metadata.category] ?? 'sans-serif'
};
}`}
</Code>
</>
Expand Down

0 comments on commit 75a0da4

Please sign in to comment.