({
state$,
metadata,
staticCSS,
variableCSS,
}: TextAreaProps)
| 112 | }); |
| 113 | |
| 114 | const TextArea = ({ |
| 115 | state$, |
| 116 | metadata, |
| 117 | staticCSS, |
| 118 | variableCSS, |
| 119 | }: TextAreaProps) => { |
| 120 | const { id, family, weights, variable, defSubset, category } = metadata; |
| 121 | const isVariable = Boolean(variable); |
| 122 | |
| 123 | const isItal = state$.preview.italic.get(); |
| 124 | const style = isItal ? 'italic' : 'normal'; |
| 125 | |
| 126 | const isNotLatin = |
| 127 | defSubset !== 'latin' || category === 'icons' || category === 'other'; |
| 128 | // biome-ignore lint/correctness/useExhaustiveDependencies: Selective. |
| 129 | useEffect(() => { |
| 130 | if (isNotLatin) { |
| 131 | state$.preview.text.set(getPreviewText(defSubset, id)); |
| 132 | } |
| 133 | }, [isNotLatin, defSubset, id]); |
| 134 | |
| 135 | return ( |
| 136 | <Flex direction="column"> |
| 137 | <Text className={classes.header}>Font Preview</Text> |
| 138 | {isVariable && variableCSS && ( |
| 139 | <> |
| 140 | <style |
| 141 | // biome-ignore lint/security/noDangerouslySetInnerHtml: Safe to use |
| 142 | dangerouslySetInnerHTML={{ |
| 143 | __html: variableCSS, |
| 144 | }} |
| 145 | /> |
| 146 | {weights.map((weight) => ( |
| 147 | <TextBox |
| 148 | key={`v-${weight}-${style}`} |
| 149 | state$={state$} |
| 150 | family={`${family} Variable`} |
| 151 | weight={weight} |
| 152 | style={style} |
| 153 | /> |
| 154 | ))} |
| 155 | </> |
| 156 | )} |
| 157 | {!isVariable && ( |
| 158 | <> |
| 159 | <style |
| 160 | // biome-ignore lint/security/noDangerouslySetInnerHtml: Safe to use |
| 161 | dangerouslySetInnerHTML={{ |
| 162 | __html: staticCSS, |
| 163 | }} |
| 164 | /> |
| 165 | {weights.map((weight) => ( |
| 166 | <TextBox |
| 167 | key={`s-${weight}-${style}`} |
| 168 | state$={state$} |
| 169 | family={family} |
| 170 | weight={weight} |
| 171 | style={style} |
nothing calls this directly
no test coverage detected