PluginProbe
Extendify / 3.2.0
Extendify v3.2.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / workflows / theme / components / change-site-design / utils / fontsOnlyVariation.js

fontsOnlyVariation.js in Extendify 3.2.0, at src/Agent/workflows/theme/components/change-site-design/utils/fontsOnlyVariation.js

20 lines 589 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const typographyOnly = (elements) =>
2 Object.fromEntries(
3 Object.entries(elements ?? {})
4 .filter(([, styles]) => styles?.typography)
5 .map(([element, styles]) => [element, { typography: styles.typography }]),
6 );
7
8 // The palette owns colour, so an option may only contribute its font leaves.
9 export const fontsOnlyVariation = (variation) => {
10 const { typography, elements } = variation?.styles ?? {};
11 const fonts = typographyOnly(elements);
12
13 return {
14 styles: {
15 ...(typography ? { typography } : {}),
16 ...(Object.keys(fonts).length ? { elements: fonts } : {}),
17 },
18 };
19 };
20