PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.13.0
Code Block Pro – Beautiful Syntax Highlighting v1.13.0
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 / seemore / BlockLeft.tsx

BlockLeft.tsx in Code Block Pro – Beautiful Syntax Highlighting 1.13.0, at src/editor/components/seemore/BlockLeft.tsx

51 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { colord, AnyColor } from 'colord';
3 import { Attributes } from '../../../types';
4
5 export const BlockLeft = ({
6 bgColor,
7 textColor,
8 seeMoreString,
9 disablePadding,
10 context,
11 footerType,
12 }: Partial<Attributes> & { context?: string }) => {
13 const backgroundColor = colord(bgColor as AnyColor).toHex();
14 const textC = colord(textColor as AnyColor);
15 const color = textC.isDark()
16 ? textC.lighten(0.05).toHex()
17 : textC.darken(0.05).toHex();
18 const hasFooter = footerType !== 'none';
19 const inEditor = context === 'editor';
20 return (
21 <div
22 className="cbp-see-more-container"
23 style={{
24 display: context === 'front' ? 'none' : 'flex',
25 flexDirection: 'column',
26 alignItems: 'flex-start',
27 width: '100%',
28 backgroundColor: 'transparent',
29 fontSize: '12px',
30 lineHeight: '1',
31 position: 'relative',
32 marginBottom: hasFooter || inEditor ? 0 : '-16px',
33 height: hasFooter && !inEditor ? '16px' : '32px',
34 }}>
35 {/* span is used to avoid theme button styling */}
36 <span
37 role={inEditor ? 'presentation' : 'button'}
38 tabIndex={inEditor ? -1 : 0}
39 className="cbp-see-more-simple-btn cbp-see-more-simple-btn-hover"
40 style={{
41 color,
42 backgroundColor,
43 padding: disablePadding ? '10px 0 0' : '10px 16px',
44 cursor: 'default',
45 }}>
46 {seeMoreString || __('Expand', 'code-block-pro')}
47 </span>
48 </div>
49 );
50 };
51