@kitconcept/volto-light-theme 6.0.0-alpha.16 → 6.0.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.changelog.draft +7 -2
  2. package/CHANGELOG.md +45 -0
  3. package/README.md +2 -4
  4. package/package.json +13 -7
  5. package/src/components/Footer/Footer.jsx +8 -15
  6. package/src/components/Footer/FooterLinks.tsx +10 -32
  7. package/src/components/Footer/FooterLogos.tsx +13 -16
  8. package/src/components/Header/Header.jsx +24 -7
  9. package/src/components/Logo/Logo.jsx +13 -10
  10. package/src/components/Theming/Theming.tsx +20 -17
  11. package/src/components/Widgets/{BlockAlignmentWidget.tsx → BlockAlignment.tsx} +9 -2
  12. package/src/components/Widgets/{BlockWidthWidget.tsx → BlockWidth.tsx} +9 -2
  13. package/src/components/Widgets/BlocksObject.tsx +353 -0
  14. package/src/components/Widgets/{ButtonsWidget.tsx → Buttons.tsx} +43 -3
  15. package/src/components/Widgets/ColorContrastChecker.tsx +108 -0
  16. package/src/components/Widgets/ColorPicker.tsx +56 -0
  17. package/src/components/Widgets/{ColorPickerWidget.tsx → ColorSwatch.tsx} +5 -5
  18. package/src/components/Widgets/ObjectList.tsx +321 -0
  19. package/src/components/Widgets/RACThemingColorPicker.tsx +1 -1
  20. package/src/components/Widgets/{SizeWidget.tsx → Size.tsx} +9 -2
  21. package/src/components/Widgets/ThemeColorSwatch.tsx +17 -0
  22. package/src/components/Widgets/schema/footerLinksSchema.ts +64 -0
  23. package/src/components/Widgets/schema/footerLogosSchema.ts +98 -0
  24. package/src/components/Widgets/schema/headerActionsSchema.ts +64 -0
  25. package/src/config/blocks.tsx +16 -7
  26. package/src/config/settings.ts +32 -8
  27. package/src/config/widgets.ts +50 -25
  28. package/src/customizations/volto/components/theme/View/RenderBlocks.jsx +1 -0
  29. package/src/helpers/DndSortableList.tsx +138 -0
  30. package/src/index.ts +15 -2
  31. package/src/theme/_bgcolor-blocks-layout.scss +0 -9
  32. package/src/theme/_layout.scss +7 -0
  33. package/src/theme/_sitemap.scss +4 -0
  34. package/src/theme/_utils.scss +13 -0
  35. package/src/theme/_widgets.scss +72 -8
  36. package/src/theme/blocks/_highlight.scss +16 -45
  37. package/src/theme/blocks/_slider.scss +8 -0
  38. package/src/types.d.ts +62 -0
  39. package/src/components/Widgets/BackgroundColorWidget.tsx +0 -17
  40. package/src/components/Widgets/BlocksObjectWidget.tsx +0 -332
  41. package/src/components/Widgets/FooterLinksWidget.tsx +0 -106
  42. package/src/components/Widgets/FooterLogosWidget.tsx +0 -120
  43. package/src/components/Widgets/ThemeColorPicker.tsx +0 -53
  44. package/src/types/index.d.ts +0 -1
package/.changelog.draft CHANGED
@@ -1,7 +1,12 @@
1
- ## 6.0.0-alpha.16 (2025-03-03)
1
+ ## 6.0.0-alpha.18 (2025-03-21)
2
+
3
+ ### Feature
4
+
5
+ - Add Color Contrast Checker component @danalvrz [#463](https://github.com/kitconcept/volto-light-theme/pull/463)
6
+ - Add docs for ColorContrastChecker. @danalvrz [#507](https://github.com/kitconcept/volto-light-theme/pull/507)
2
7
 
3
8
  ### Bugfix
4
9
 
5
- - Fix last edge case in the intranet header in edit mode with the `complementary_logo`. @sneridagh [#483](https://github.com/kitconcept/volto-light-theme/pull/483)
10
+ - Make the `footer_links` and `footer_logos` loops more resilient. @sneridagh [#508](https://github.com/kitconcept/volto-light-theme/pull/508)
6
11
 
7
12
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,51 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 6.0.0-alpha.18 (2025-03-21)
12
+
13
+ ### Feature
14
+
15
+ - Add Color Contrast Checker component @danalvrz [#463](https://github.com/kitconcept/volto-light-theme/pull/463)
16
+ - Add docs for ColorContrastChecker. @danalvrz [#507](https://github.com/kitconcept/volto-light-theme/pull/507)
17
+
18
+ ### Bugfix
19
+
20
+ - Make the `footer_links` and `footer_logos` loops more resilient. @sneridagh [#508](https://github.com/kitconcept/volto-light-theme/pull/508)
21
+
22
+ ## 6.0.0-alpha.17 (2025-03-20)
23
+
24
+ ### Breaking
25
+
26
+ - Renamed widget: `ThemeColorPicker` -> `ColorPicker`. @sneridagh [#486](https://github.com/kitconcept/volto-light-theme/pull/486)
27
+ - Renamed widget: `BackgroundColorWidget` -> `themeColorSwatch`. @sneridagh [#486](https://github.com/kitconcept/volto-light-theme/pull/486)
28
+ - Renamed widget: `sizeWidget` -> `size`. @sneridagh [#486](https://github.com/kitconcept/volto-light-theme/pull/486)
29
+
30
+ ### Feature
31
+
32
+ - New widget: `colorPicker`. @sneridagh [#486](https://github.com/kitconcept/volto-light-theme/pull/486)
33
+ - New widget: `themeColorSwatch`. @sneridagh [#486](https://github.com/kitconcept/volto-light-theme/pull/486)
34
+ - Add `@kitconcept/volto-banner-block` to the recommended VLT add-ons. @sneridagh [#487](https://github.com/kitconcept/volto-light-theme/pull/487)
35
+ - New widget: `object_list`. @sneridagh [#491](https://github.com/kitconcept/volto-light-theme/pull/491)
36
+ - Use the `@inherit` endpoint. @sneridagh [#494](https://github.com/kitconcept/volto-light-theme/pull/494)
37
+ - Update volto-highlight-block to 4.1.0 @sneridagh [#498](https://github.com/kitconcept/volto-light-theme/pull/498)
38
+
39
+ ### Bugfix
40
+
41
+ - Remove title attribute from the logo. @davisagli [#336](https://github.com/kitconcept/volto-light-theme/pull/336)
42
+ - Color fixes for description, links and buttons for Slider & Highlight blocks. @danalvrz [#476](https://github.com/kitconcept/volto-light-theme/pull/476)
43
+ - Fixed nested blocks theme: when the theme is not set, inherit from parent instead of getting the default one for the current nested block. @sneridagh [#489](https://github.com/kitconcept/volto-light-theme/pull/489)
44
+ - Fix workflow: acceptance always runs, even if one of the dependencies are skipped. @sneridagh [#492](https://github.com/kitconcept/volto-light-theme/pull/492)
45
+ - Add actions to header + Fix hydration problem in /edit + Sitemap container. @sneridagh [#492](https://github.com/kitconcept/volto-light-theme/pull/492)
46
+ - Specify desktop flex direction starting at 768px screen width. @danalvrz [#496](https://github.com/kitconcept/volto-light-theme/pull/496)
47
+
48
+ ### Internal
49
+
50
+ - Added deployment workflow. @ericof [#495](https://github.com/kitconcept/volto-light-theme/pull/495)
51
+
52
+ ### Documentation
53
+
54
+ - Update requirements for plone.restapi in docs. @sneridagh [#498](https://github.com/kitconcept/volto-light-theme/pull/498)
55
+
11
56
  ## 6.0.0-alpha.16 (2025-03-03)
12
57
 
13
58
  ### Bugfix
package/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # Volto Light Theme by kitconcept
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/@kitconcept/volto-light-theme.svg)](https://www.npmjs.com/package/@kitconcept/volto-light-theme)
4
- [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/code.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions)
5
- [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/unit.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions)
6
- [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/acceptance.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions)
4
+ [![Build Status](https://github.com/kitconcept/volto-light-theme/actions/workflows/main.yml/badge.svg)](https://github.com/kitconcept/volto-light-theme/actions)
7
5
 
8
6
  <picture>
9
7
  <source media="(prefers-color-scheme: dark)" srcset="https://kitconcept.com/kitconcept-white.svg">
@@ -16,7 +14,7 @@ The main vision of the Volto Light Theme (VLT) is to serve as a foundation for k
16
14
  It incorporates feedback from the company's clients and Plone community from the last few years of projects and the success stories in the UI/UX side.
17
15
  It aims to be future-proof, keeping it aligned with the upcoming Volto and Plone 7 vision in terms of theming strategy decided by the Plone community.
18
16
 
19
- ![Volto-Light-Theme](https://github.com/kitconcept/volto-light-theme/raw/main/volto-light-theme.png)
17
+ ![Volto-Light-Theme](https://github.com/kitconcept/volto-light-theme/raw/main/docs/_static/volto-light-theme.png)
20
18
 
21
19
  ## Documentation
22
20
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "6.0.0-alpha.16",
3
+ "version": "6.0.0-alpha.18",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.ts",
6
- "types": "src/types/index.d.ts",
6
+ "types": "src/index.ts",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+ssh://git@github.com/kitconcept/volto-light-theme.git"
@@ -33,26 +33,32 @@
33
33
  "@types/react": "^18.3.12",
34
34
  "@types/react-dom": "^18.3.1",
35
35
  "release-it": "^17.7.0",
36
- "@plone/types": "1.3.1"
36
+ "@plone/types": "1.3.2"
37
37
  },
38
38
  "dependencies": {
39
- "react-aria-components": "^1.5.0",
39
+ "@dnd-kit/core": "6.0.8",
40
+ "@dnd-kit/sortable": "7.0.2",
41
+ "@dnd-kit/utilities": "3.2.2",
42
+ "react-animate-height": "^3.2.3",
43
+ "react-aria-components": "^1.7.0",
40
44
  "react-colorful": "^5.6.1",
41
45
  "uuid": "^11.0.0",
42
- "@plone/components": "^3.0.1"
46
+ "@plone/components": "^3.0.2"
43
47
  },
44
48
  "peerDependencies": {
45
49
  "@eeacms/volto-accordion-block": "^10.4.6",
46
- "@kitconcept/volto-button-block": "^2.3.1 || ^3.0.3",
50
+ "@kitconcept/volto-banner-block": "^1.0.1",
51
+ "@kitconcept/volto-button-block": "^3.0.3",
47
52
  "@kitconcept/volto-dsgvo-banner": "^2.3.2",
48
53
  "@kitconcept/volto-heading-block": "^2.4.0",
49
- "@kitconcept/volto-highlight-block": "^4.0.0",
54
+ "@kitconcept/volto-highlight-block": "^4.1.0",
50
55
  "@kitconcept/volto-introduction-block": "^1.0.0",
51
56
  "@kitconcept/volto-separator-block": "^4.1.2",
52
57
  "@kitconcept/volto-slider-block": "^6.3.1",
53
58
  "classnames": "^2.2.6",
54
59
  "lodash": "4.17.21",
55
60
  "react": "18.2.0",
61
+ "react-dom": "18.2.0",
56
62
  "react-intl": "^3.12.1",
57
63
  "react-redux": "^8.1.2",
58
64
  "react-router-dom": "^5.2.0"
@@ -1,4 +1,3 @@
1
- // SemanticUI-free pre-@plone/components
2
1
  import React from 'react';
3
2
  import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
4
3
  import { useSelector, shallowEqual } from 'react-redux';
@@ -17,21 +16,19 @@ const messages = defineMessages({
17
16
 
18
17
  const Footer = () => {
19
18
  const intl = useIntl();
20
- const {
21
- content,
22
- lang,
23
- siteActions = [],
24
- } = useSelector(
19
+ const { content } = useSelector(
25
20
  (state) => ({
26
- lang: state.intl.locale,
27
- siteActions: state.actions?.actions?.site_actions,
28
21
  content: state.content.data,
29
22
  }),
30
23
  shallowEqual,
31
24
  );
32
25
  const location = useLocation();
33
- const navroot = useSelector((state) => state.navroot.data.navroot);
34
- const footerLinks = navroot?.footer_links;
26
+ const footerSettings = useSelector(
27
+ (state) =>
28
+ state.content.data?.['@components']?.inherit?.['voltolighttheme.footer']
29
+ ?.data,
30
+ );
31
+ const footerLinks = footerSettings?.footer_links;
35
32
 
36
33
  return (
37
34
  <footer id="footer">
@@ -83,11 +80,7 @@ const Footer = () => {
83
80
  }}
84
81
  />
85
82
  </div>
86
- <FooterLinks
87
- links={footerLinks}
88
- siteActions={siteActions}
89
- lang={lang}
90
- />
83
+ <FooterLinks links={footerLinks} />
91
84
  <div className="logo">
92
85
  <Logo />
93
86
  </div>
@@ -1,20 +1,17 @@
1
1
  import isEmpty from 'lodash/isEmpty';
2
- import { addAppURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
2
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
3
3
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
4
- import type { BlocksData } from '@plone/types';
5
- import config from '@plone/volto/registry';
4
+ import type { SiteFooterSettings } from '../../types';
6
5
 
7
- type FooterLinksProps = { links: BlocksData; siteActions: any; lang: string };
6
+ type FooterLinksProps = { links: SiteFooterSettings['footer_links'] };
8
7
 
9
8
  const FooterLinks = (props: FooterLinksProps) => {
10
- const { lang, links, siteActions } = props;
9
+ const { links } = props;
11
10
 
12
11
  return (
13
12
  <ul className="footer-links">
14
- {!isEmpty(links?.blocks)
15
- ? links.blocks_layout.items.map((itemId) => {
16
- const link = links.blocks[itemId];
17
-
13
+ {links && Array.isArray(links)
14
+ ? links.map((link) => {
18
15
  if (isEmpty(link) || !link.href) return null;
19
16
 
20
17
  const title = link.title || link.href[0]['title'];
@@ -24,32 +21,13 @@ const FooterLinks = (props: FooterLinksProps) => {
24
21
 
25
22
  return (
26
23
  <li className="item" key={href}>
27
- <UniversalLink href={href}>{title}</UniversalLink>
24
+ <UniversalLink href={href} openLinkInNewTab={undefined}>
25
+ {title}
26
+ </UniversalLink>
28
27
  </li>
29
28
  );
30
29
  })
31
- : siteActions?.length
32
- ? siteActions.map((item) => (
33
- <li className="item" key={item.id}>
34
- <UniversalLink
35
- className="item"
36
- href={
37
- config.settings.isMultilingual
38
- ? `/${lang}/${
39
- item.url
40
- ? flattenToAppURL(item.url)
41
- : addAppURL(item.id)
42
- }`
43
- : item.url
44
- ? flattenToAppURL(item.url)
45
- : addAppURL(item.id)
46
- }
47
- >
48
- {item?.title}
49
- </UniversalLink>
50
- </li>
51
- ))
52
- : null}
30
+ : null}
53
31
  </ul>
54
32
  );
55
33
  };
@@ -1,10 +1,10 @@
1
1
  import type { Content } from '@plone/types';
2
- import isEmpty from 'lodash/isEmpty';
3
2
  import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
4
3
  import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
5
4
  import { useSelector } from 'react-redux';
6
5
  import { Container } from '@plone/components';
7
6
  import cx from 'classnames';
7
+ import type { SiteFooterSettings } from '../../types';
8
8
 
9
9
  type FormState = {
10
10
  content: {
@@ -13,25 +13,23 @@ type FormState = {
13
13
  form: {
14
14
  global: Content;
15
15
  };
16
- navroot: {
17
- data: {
18
- navroot: Content;
19
- };
20
- };
21
16
  };
22
17
 
23
18
  const FooterLogos = () => {
24
- const navroot = useSelector<FormState, Content>(
25
- (state) => state.navroot.data.navroot,
26
- );
27
19
  const formState = useSelector<FormState, Content>(
28
20
  (state) => state.form.global,
29
21
  );
30
- const logos = formState?.footer_logos || navroot?.footer_logos;
31
- const logosSize = formState?.footer_logos_size || navroot?.footer_logos_size;
22
+ const footerSettings = useSelector<FormState, SiteFooterSettings>(
23
+ (state) =>
24
+ state.content.data?.['@components']?.inherit?.['voltolighttheme.footer']
25
+ ?.data,
26
+ );
27
+ const logos = formState?.footer_logos || footerSettings?.footer_logos;
28
+ const logosSize =
29
+ formState?.footer_logos_size || footerSettings?.footer_logos_size;
32
30
  const footer_logos_container_width =
33
31
  formState?.footer_logos_container_width ||
34
- navroot?.footer_logos_container_width;
32
+ footerSettings?.footer_logos_container_width;
35
33
 
36
34
  return (
37
35
  <Container className={cx({ [footer_logos_container_width]: 1 })}>
@@ -40,9 +38,8 @@ const FooterLogos = () => {
40
38
  [logosSize]: logosSize,
41
39
  })}
42
40
  >
43
- {!isEmpty(logos?.blocks)
44
- ? logos.blocks_layout.items.map((itemId) => {
45
- const logo = logos.blocks[itemId];
41
+ {logos && Array.isArray(logos)
42
+ ? logos.map((logo) => {
46
43
  const logoInfo: {
47
44
  hrefTitle: string;
48
45
  href: string;
@@ -73,7 +70,7 @@ const FooterLogos = () => {
73
70
  if (!logoInfo.src) return null;
74
71
 
75
72
  return (
76
- <li className="item" key={logoInfo.href}>
73
+ <li className="item" key={logoInfo['@id']}>
77
74
  {/* @ts-ignore */}
78
75
  <ConditionalLink
79
76
  condition={logoInfo.href}
@@ -1,4 +1,5 @@
1
1
  // SemanticUI-free pre-@plone/components
2
+ import { useEffect, useState } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { useDispatch, useSelector } from 'react-redux';
4
5
  import { Button, Container } from '@plone/components';
@@ -69,21 +70,35 @@ const InternetHeader = ({ pathname, siteLabel, token, siteAction }) => {
69
70
  );
70
71
  };
71
72
 
72
- const IntranetHeader = ({ pathname, siteLabel, token, siteAction }) => {
73
+ const IntranetHeader = ({ pathname, siteLabel, token }) => {
74
+ const [isClient, setIsClient] = useState(false);
75
+ useEffect(() => {
76
+ setIsClient(true);
77
+ }, []);
78
+
73
79
  const dispatch = useDispatch();
74
80
 
75
- const navRoot = useSelector((state) => state.navroot?.data?.navroot);
81
+ const headerSettings = useSelector(
82
+ (state) =>
83
+ state.content.data?.['@components']?.inherit?.['voltolighttheme.header']
84
+ ?.data,
85
+ );
76
86
  const formData = useSelector((state) => state.form.global);
77
87
 
78
88
  const intranetFlag =
79
89
  !isEmpty(formData) && formData.intranet_flag
80
90
  ? formData?.intranet_flag || siteLabel
81
- : navRoot?.intranet_flag || siteLabel;
91
+ : headerSettings?.intranet_flag || siteLabel;
82
92
 
83
93
  const complementary_logo =
84
94
  !isEmpty(formData) && formData?.complementary_logo?.data
85
95
  ? `data:${formData.complementary_logo['content-type']};base64,${formData.complementary_logo.data}`
86
- : navRoot?.complementary_logo?.download;
96
+ : headerSettings?.complementary_logo?.download;
97
+
98
+ const headerActions =
99
+ !isEmpty(formData) && formData?.header_actions
100
+ ? formData.header_actions
101
+ : headerSettings?.header_actions;
87
102
 
88
103
  const pointToSidebar = (fieldSetName, fieldId) => {
89
104
  dispatch(setSidebarTab(0));
@@ -98,14 +113,16 @@ const IntranetHeader = ({ pathname, siteLabel, token, siteAction }) => {
98
113
 
99
114
  <div className="tools">
100
115
  {!token && <Anontools />}
101
- {siteAction &&
102
- siteAction.map((item) => (
103
- <UniversalLink key={item.url} href={item.url}>
116
+ {headerActions &&
117
+ Array.isArray(headerActions) &&
118
+ headerActions.map((item) => (
119
+ <UniversalLink key={item['@id']} href={item.href?.[0]['@id']}>
104
120
  {item.title}
105
121
  </UniversalLink>
106
122
  ))}
107
123
  </div>
108
124
  {siteLabel &&
125
+ isClient &&
109
126
  (!isEmpty(formData) ? (
110
127
  <Button
111
128
  className="intranet-flag"
@@ -21,28 +21,31 @@ const Logo = () => {
21
21
  const site = useSelector((state) => state.site.data);
22
22
  const navroot = useSelector((state) => state.navroot.data);
23
23
  const navRootPath = flattenToAppURL(navroot?.navroot?.['@id']) || '/';
24
- const navRootLogo = navroot?.navroot?.logo?.download || null;
25
- const navRootLogoWidth = navroot?.navroot?.logo?.width || null;
26
- const navRootLogoHeight = navroot?.navroot?.logo?.height || null;
24
+ const headerSettings = useSelector(
25
+ (state) =>
26
+ state.content.data?.['@components']?.inherit?.['voltolighttheme.header']
27
+ ?.data,
28
+ );
29
+ const logo = headerSettings?.logo;
30
+ const logoUrl = logo?.download || null;
31
+ const logoWidth = logo?.width || null;
32
+ const logoHeight = logo?.height || null;
27
33
 
28
34
  return (
29
35
  <Link to={navRootPath} aria-label={intl.formatMessage(messages.home)}>
30
36
  <img
31
37
  src={
32
- navRootLogo
33
- ? flattenToAppURL(navRootLogo)
38
+ logoUrl
39
+ ? flattenToAppURL(logoUrl)
34
40
  : site['plone.site_logo']
35
41
  ? flattenToAppURL(site['plone.site_logo'])
36
42
  : LogoImage
37
43
  }
38
- width={navRootLogoWidth}
39
- height={navRootLogoHeight}
44
+ width={logoWidth}
45
+ height={logoHeight}
40
46
  alt={
41
47
  intl.formatMessage(messages.logoOf) + ' ' + site['plone.site_title']
42
48
  }
43
- title={
44
- intl.formatMessage(messages.logoOf) + ' ' + site['plone.site_title']
45
- }
46
49
  />
47
50
  </Link>
48
51
  );
@@ -2,7 +2,7 @@ import Helmet from '@plone/volto/helpers/Helmet/Helmet';
2
2
  import type { Content } from '@plone/types';
3
3
  import { useSelector } from 'react-redux';
4
4
  import isEmpty from 'lodash/isEmpty';
5
- import config from '@plone/registry';
5
+ import type { SiteThemeSettings } from '../../types';
6
6
 
7
7
  type FormState = {
8
8
  content: {
@@ -13,34 +13,37 @@ type FormState = {
13
13
  };
14
14
  };
15
15
 
16
- // TODO: Change when we have the final list of colors
17
- // and if they are nested in the serialization under a key
18
- function buildStyleTag(content: Content, colors: string[]) {
19
- if (Array.isArray(colors)) {
20
- return colors
21
- .filter((color) => content[color])
22
- .map((color) => {
23
- return `--${color.replace(/_/g, '-')}: ${content[color]}; `;
24
- })
25
- .join('');
26
- }
16
+ function buildStyleTag(content: Partial<Content>, colors: SiteThemeSettings) {
17
+ const colorKeys = Object.keys(colors);
18
+ return colorKeys
19
+ .filter((color) => content[color])
20
+ .map((color) => {
21
+ return `--${color.replace(/_/g, '-')}: ${content[color]}; `;
22
+ })
23
+ .join('');
27
24
  }
28
25
 
29
- const Theming = ({ navRoot }) => {
30
- const colorFields = config.settings.userDefinedControlPanelColors;
26
+ const Theming = ({ content }: { content: Content }) => {
27
+ const colorSettings =
28
+ content?.['@components']?.inherit?.['voltolighttheme.theme']?.data;
31
29
  const formData = useSelector<FormState, Content>(
32
30
  (state) => state.form.global,
33
31
  );
34
32
 
35
- const liveContent = navRoot ? (!isEmpty(formData) ? formData : navRoot) : {};
33
+ const liveContent = colorSettings
34
+ ? !isEmpty(formData)
35
+ ? formData
36
+ : colorSettings
37
+ : {};
36
38
 
37
39
  return (
38
40
  <>
39
41
  <Helmet>
40
42
  <style>
41
- {`
43
+ {colorSettings &&
44
+ `
42
45
  :root {
43
- ${buildStyleTag(liveContent, colorFields)}
46
+ ${buildStyleTag(liveContent, colorSettings)}
44
47
  }
45
48
  `}
46
49
  </style>
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
- import ButtonsWidget, { type ButtonsWidgetProps } from './ButtonsWidget';
3
+ import ButtonsWidget, {
4
+ type ActionInfo,
5
+ type ButtonsWidgetProps,
6
+ } from './Buttons';
4
7
  import imageFitSVG from '@plone/volto/icons/image-fit.svg';
5
8
  import imageLeftSVG from '@plone/volto/icons/image-left.svg';
6
9
  import imageRightSVG from '@plone/volto/icons/image-right.svg';
@@ -21,7 +24,11 @@ const messages = defineMessages({
21
24
  },
22
25
  });
23
26
 
24
- export const defaultActionsInfo = ({ intl }: { intl: IntlShape }) => ({
27
+ export const defaultActionsInfo = ({
28
+ intl,
29
+ }: {
30
+ intl: IntlShape;
31
+ }): Record<string, ActionInfo> => ({
25
32
  left: [imageLeftSVG, intl.formatMessage(messages.left)],
26
33
  right: [imageRightSVG, intl.formatMessage(messages.right)],
27
34
  center: [imageFitSVG, intl.formatMessage(messages.center)],
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  import { defineMessages, useIntl } from 'react-intl';
3
3
  import type { IntlShape } from 'react-intl';
4
- import ButtonsWidget, { type ButtonsWidgetProps } from './ButtonsWidget';
4
+ import ButtonsWidget, {
5
+ type ActionInfo,
6
+ type ButtonsWidgetProps,
7
+ } from './Buttons';
5
8
  import imageFitSVG from '@plone/volto/icons/image-fit.svg';
6
9
  import imageNarrowSVG from '@plone/volto/icons/image-narrow.svg';
7
10
  import imageWideSVG from '@plone/volto/icons/image-wide.svg';
@@ -26,7 +29,11 @@ const messages = defineMessages({
26
29
  },
27
30
  });
28
31
 
29
- export const defaultActionsInfo = ({ intl }: { intl: IntlShape }) => ({
32
+ export const defaultActionsInfo = ({
33
+ intl,
34
+ }: {
35
+ intl: IntlShape;
36
+ }): Record<string, ActionInfo> => ({
30
37
  narrow: [imageNarrowSVG, intl.formatMessage(messages.narrow)],
31
38
  default: [imageFitSVG, intl.formatMessage(messages.default)],
32
39
  layout: [imageWideSVG, intl.formatMessage(messages.layout)],