Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Present font weights on the Storybook Typography page #230

Open
blackbart420 opened this issue Feb 7, 2023 · 0 comments
Open

Present font weights on the Storybook Typography page #230

blackbart420 opened this issue Feb 7, 2023 · 0 comments

Comments

@blackbart420
Copy link

blackbart420 commented Feb 7, 2023

Hello,
on the storybook page "Typography", displaying the choosed typefaces and font sizes,
is there a way to show also the font weights?

I edited the file "typeset.stories.mdx" as following but it has no effect:

import { Meta, Subtitle } from '@storybook/addon-docs';
import { Typeset } from '@wingsuit-designsystem/storybook';
const tailwindFile = require('../../config/silo/tailwind.json');
const fontFamilies = tailwindFile.tailwind.theme.fontFamily;
const intFontSizes = tailwindFile.tailwind.theme.fontSize;
const intFontWeights = tailwindFile.tailwind.theme.fontWeight;
const fontSizes = {}
Object.keys(intFontSizes).forEach((key)=>{
  fontSizes[key] = [intFontSizes[key][0]]
})
const fontWeights = {}
Object.keys(intFontWeights).forEach((key)=>{
  fontWeights[key] = [intFontWeights[key]]
})

<Meta title="Tokens/Typography"
parameters={{ viewMode: 'docs', previewTabs: { canvas: { hidden: true }}}}
/>

# Typography
<Subtitle>Choosed typefaces and font sizes</Subtitle>

<div>
{
  Object.keys(fontFamilies).map((key,i)=>{
    return (
      <div key={key}>
        <Subtitle><b>Font Family:</b> {fontFamilies[key][0]} ({key})</Subtitle>
        <Typeset fontFamily={fontFamilies[key][0]} classNamePrefix="text-" fontSizes={fontSizes} fontWeights={fontWeights} />
      </div>
    )
  })
}
</div>

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant