PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / trunk
Code Block Pro – Beautiful Syntax Highlighting vtrunk
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / src / editor / components / headers / StringSmall.tsx

StringSmall.tsx in Code Block Pro – Beautiful Syntax Highlighting trunk, at src/editor/components/headers/StringSmall.tsx

36 lines 900 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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