PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.2.0
Tableberg – Simple Gutenberg Table Block v1.2.0
1.2.0 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 All 43 releases
tableberg / components / editor / TypographyControls.tsx

TypographyControls.tsx in Tableberg – Simple Gutenberg Table Block 1.2.0, at components/editor/TypographyControls.tsx

77 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 TypographyValue,
3 getTypography,
4 } from "@tableberg/shared/utils/typography";
5
6 import FontFamilyControl from "./FontFamilyControl";
7 import FontSizeControl from "./FontSizeControl";
8 import FontAppearanceControl from "./FontAppearanceControl";
9 import LineHeightControl from "./LineHeightControl";
10 import LetterSpacingControl from "./LetterSpacingControl";
11 import TextDecorationControl from "./TextDecorationControl";
12 import TextTransformControl from "./TextTransformControl";
13
14 interface Props {
15 value?: Partial<TypographyValue>;
16 onChange: (updates: Partial<TypographyValue>) => void;
17 panelId?: string;
18 }
19
20 /**
21 * The whole typography group in one go: the same options the core blocks
22 * offer, as ToolsPanelItems, so a block only has to put them in a ToolsPanel
23 * and store the values. Individual controls are exported too, for a block
24 * that wants just one of them.
25 */
26 export default function TypographyControls({
27 value,
28 onChange,
29 panelId,
30 }: Props) {
31 const typography = getTypography(value);
32
33 return (
34 <>
35 <FontFamilyControl
36 panelId={panelId}
37 value={typography.fontFamily}
38 onChange={fontFamily => onChange({ fontFamily })}
39 />
40 <FontSizeControl
41 panelId={panelId}
42 value={typography.fontSize}
43 onChange={fontSize => onChange({ fontSize })}
44 />
45 <FontAppearanceControl
46 panelId={panelId}
47 fontFamily={typography.fontFamily}
48 value={{
49 fontStyle: typography.fontStyle,
50 fontWeight: typography.fontWeight,
51 }}
52 onChange={appearance => onChange(appearance)}
53 />
54 <LineHeightControl
55 panelId={panelId}
56 value={typography.lineHeight}
57 onChange={lineHeight => onChange({ lineHeight })}
58 />
59 <TextTransformControl
60 panelId={panelId}
61 value={typography.textTransform}
62 onChange={textTransform => onChange({ textTransform })}
63 />
64 <LetterSpacingControl
65 panelId={panelId}
66 value={typography.letterSpacing}
67 onChange={letterSpacing => onChange({ letterSpacing })}
68 />
69 <TextDecorationControl
70 panelId={panelId}
71 value={typography.textDecoration}
72 onChange={textDecoration => onChange({ textDecoration })}
73 />
74 </>
75 );
76 }
77