1+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2+ import React from 'react'
13import { css } from 'styled-components'
24
35import {
@@ -11,7 +13,7 @@ import {
1113 TYPOGRAPHY ,
1214} from '@opentrons/components'
1315
14- import type { Meta , Story } from '@storybook/react'
16+ import type { Meta , StoryFn } from '@storybook/react'
1517import type { FlattenSimpleInterpolation } from 'styled-components'
1618
1719const fontStyles = {
@@ -139,7 +141,7 @@ const fontWeightForPairForLegacy = (style: string, weight: string): string => {
139141
140142const valueFromFlattenedInterp = (
141143 style : FlattenSimpleInterpolation ,
142- valueName : str
144+ valueName : string
143145) : string => {
144146 return style . reduce (
145147 ( [ sawKey , value ] : [ boolean , null | string ] , el ) => {
@@ -195,31 +197,35 @@ const fontWeightForPair = (
195197 ? fontWeightForPairForHelix ( style , weight )
196198 : fontWeightForPairForLegacy ( style , weight )
197199
198- const Template : Story < TypographyStorybookProps > = args => {
199- const fonts = fontStyles [ args . styles ]
200+ const Template : StoryFn < TypographyStorybookProps > = args => {
201+ const fonts = fontStyles [ args . styles ] as Array < [ string , string ] >
200202 return (
201203 < Flex
202204 flexDirection = { DIRECTION_COLUMN }
203205 gridGap = { SPACING . spacing8 }
204206 padding = { SPACING . spacing24 }
205207 >
206- { fonts . map ( ( [ style , weight ] ) => (
207- < Box key = { `${ style } _${ weight } ` } alignItems = { ALIGN_CENTER } >
208- < Text css = { styleForPair ( style , weight , args . styles ) } >
209- { `${ style } ${ weight } (${ fontWeightForPair (
210- style ,
211- weight ,
212- args . styles
213- ) } , ${ fontSizeForPair (
214- style ,
215- weight ,
216- args . styles
217- ) } , ${ lineHeightForPair ( style , weight , args . styles ) } ): ${
218- args . text
219- } `}
220- </ Text >
221- </ Box >
222- ) ) }
208+ { fonts . map ( ( [ style , weight ] : [ string , string ] ) => {
209+ const styleStr : string = String ( style )
210+ const weightStr : string = String ( weight )
211+ return (
212+ < Box key = { `${ styleStr } _${ weightStr } ` } alignItems = { ALIGN_CENTER } >
213+ < Text css = { styleForPair ( styleStr , weightStr , args . styles ) } >
214+ { `${ styleStr } ${ weightStr } (${ fontWeightForPair (
215+ styleStr ,
216+ weightStr ,
217+ args . styles
218+ ) } , ${ fontSizeForPair (
219+ styleStr ,
220+ weightStr ,
221+ args . styles
222+ ) } , ${ lineHeightForPair ( styleStr , weightStr , args . styles ) } ): ${
223+ args . text
224+ } `}
225+ </ Text >
226+ </ Box >
227+ )
228+ } ) }
223229 </ Flex >
224230 )
225231}
0 commit comments