| 1 |
import type { Attributes, Lang } from '../../../types'; |
| 2 |
import { computeLineHighlightColor, findTextColor } from '../../../util/colors'; |
| 3 |
import { languages } from '../../../util/languages'; |
| 4 |
|
| 5 |
export const StringSmall = (attributes: Attributes) => { |
| 6 |
const { language, bgColor, textColor, headerString } = attributes; |
| 7 |
let textBorder = computeLineHighlightColor(textColor, attributes); |
| 8 |
|
| 9 |
if (textColor?.startsWith('var(')) { |
| 10 |
textBorder = findTextColor(attributes) ?? textColor; |
| 11 |
} |
| 12 |
return ( |
| 13 |
<span |
| 14 |
style={{ |
| 15 |
display: 'flex', |
| 16 |
alignItems: 'center', |
| 17 |
padding: '10px 0px 0 16px', |
| 18 |
fontSize: '0.8em', |
| 19 |
width: '100%', |
| 20 |
textAlign: 'left', |
| 21 |
backgroundColor: bgColor, |
| 22 |
fontStyle: 'italic', |
| 23 |
color: textColor, |
| 24 |
}} |
| 25 |
> |
| 26 |
<span |
| 27 |
style={{ |
| 28 |
borderBottom: `1px solid ${textBorder}`, |
| 29 |
}} |
| 30 |
> |
| 31 |
{headerString || languages[language as Lang]} |
| 32 |
</span> |
| 33 |
</span> |
| 34 |
); |
| 35 |
}; |
| 36 |
|