|
| 1 | +import * as React from 'react'; |
| 2 | +import { makeStyles, teamsLightTheme } from '@fluentui/react-components'; |
| 3 | +import type { FontFamilyTokens, FontSizeTokens, FontWeightTokens, LineHeightTokens } from '@fluentui/react-components'; |
| 4 | + |
| 5 | +const theme = teamsLightTheme; |
| 6 | + |
| 7 | +const useStyles = makeStyles({ |
| 8 | + propGrid: { |
| 9 | + display: 'grid', |
| 10 | + gridTemplateColumns: 'auto 1fr', |
| 11 | + gridTemplateRows: '1fr', |
| 12 | + rowGap: '10px', |
| 13 | + columnGap: '10px', |
| 14 | + fontFamily: theme.fontFamilyBase, |
| 15 | + alignContent: 'center', |
| 16 | + alignItems: 'center', |
| 17 | + }, |
| 18 | +}); |
| 19 | + |
| 20 | +export const FontFamily = () => { |
| 21 | + const styles = useStyles(); |
| 22 | + |
| 23 | + const fontFamilies = Object.keys(theme).filter(tokenName => |
| 24 | + tokenName.startsWith('fontFamily'), |
| 25 | + ) as (keyof FontFamilyTokens)[]; |
| 26 | + |
| 27 | + return ( |
| 28 | + <div className={styles.propGrid}> |
| 29 | + {fontFamilies.map(fontFamily => [ |
| 30 | + <div key={fontFamily}>{fontFamily}</div>, |
| 31 | + <div key={`${fontFamily}-value`} style={{ fontFamily: `${theme[fontFamily]}` }}> |
| 32 | + {theme[fontFamily]}Font family {fontFamily} |
| 33 | + </div>, |
| 34 | + ])} |
| 35 | + </div> |
| 36 | + ); |
| 37 | +}; |
| 38 | + |
| 39 | +export const FontSize = () => { |
| 40 | + const styles = useStyles(); |
| 41 | + |
| 42 | + const fontSizes = Object.keys(theme).filter(tokenName => |
| 43 | + tokenName.startsWith('fontSize'), |
| 44 | + ) as (keyof FontSizeTokens)[]; |
| 45 | + |
| 46 | + return ( |
| 47 | + <div className={styles.propGrid}> |
| 48 | + {fontSizes.map(fontSize => ( |
| 49 | + <> |
| 50 | + <div key={fontSize}>{fontSize}</div> |
| 51 | + <div key={`${fontSize}-value`} style={{ fontSize: theme[fontSize], lineHeight: theme[fontSize] }}> |
| 52 | + {fontSize} |
| 53 | + </div> |
| 54 | + </> |
| 55 | + ))} |
| 56 | + </div> |
| 57 | + ); |
| 58 | +}; |
| 59 | + |
| 60 | +export const LineHeight = () => { |
| 61 | + const styles = useStyles(); |
| 62 | + |
| 63 | + const lineHeightKeys = Object.keys(theme).filter(tokenName => |
| 64 | + tokenName.startsWith('lineHeight'), |
| 65 | + ) as (keyof LineHeightTokens)[]; |
| 66 | + |
| 67 | + return ( |
| 68 | + <div className={styles.propGrid}> |
| 69 | + {lineHeightKeys.map(lineHeight => [ |
| 70 | + <div key={lineHeight}>{lineHeight}</div>, |
| 71 | + <div key={`${lineHeight}-value`} style={{ lineHeight: theme[lineHeight], backgroundColor: '#eee' }}> |
| 72 | + {lineHeight} |
| 73 | + </div>, |
| 74 | + ])} |
| 75 | + </div> |
| 76 | + ); |
| 77 | +}; |
| 78 | + |
| 79 | +export const FontWeight = () => { |
| 80 | + const styles = useStyles(); |
| 81 | + |
| 82 | + const fontWeights = Object.keys(theme).filter(tokenName => |
| 83 | + tokenName.startsWith('fontWeight'), |
| 84 | + ) as (keyof FontWeightTokens)[]; |
| 85 | + |
| 86 | + return ( |
| 87 | + <div className={styles.propGrid}> |
| 88 | + {fontWeights.map(fontWeight => [ |
| 89 | + <div key={fontWeight}>{fontWeight}</div>, |
| 90 | + <div key={`${fontWeight}-value`} style={{ fontWeight: theme[fontWeight] }}> |
| 91 | + Font weight {fontWeight} |
| 92 | + </div>, |
| 93 | + ])} |
| 94 | + </div> |
| 95 | + ); |
| 96 | +}; |
0 commit comments