@kitconcept/volto-light-theme 6.0.0-alpha.8 → 6.0.0-alpha.9

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.
package/.changelog.draft CHANGED
@@ -1,7 +1,12 @@
1
- ## 6.0.0-alpha.8 (2024-12-13)
1
+ ## 6.0.0-alpha.9 (2024-12-17)
2
+
3
+ ### Feature
4
+
5
+ - Added logos footer handlers for logo size and logos container size. Overall improvements for look and feel. @sneridagh [#451](https://github.com/kitconcept/volto-light-theme/pull/451)
2
6
 
3
7
  ### Bugfix
4
8
 
5
- - Remove the `aspect-ratio` handler by default in images and teasers. @sneridagh [#448](https://github.com/kitconcept/volto-light-theme/pull/448)
9
+ - Remove teaser styling tab inside grids since it's empty. @sneridagh [#449](https://github.com/kitconcept/volto-light-theme/pull/449)
10
+ - Remove the last dangling `aspect-ratio` handler from image block. @sneridagh [#450](https://github.com/kitconcept/volto-light-theme/pull/450)
6
11
 
7
12
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 6.0.0-alpha.9 (2024-12-17)
12
+
13
+ ### Feature
14
+
15
+ - Added logos footer handlers for logo size and logos container size. Overall improvements for look and feel. @sneridagh [#451](https://github.com/kitconcept/volto-light-theme/pull/451)
16
+
17
+ ### Bugfix
18
+
19
+ - Remove teaser styling tab inside grids since it's empty. @sneridagh [#449](https://github.com/kitconcept/volto-light-theme/pull/449)
20
+ - Remove the last dangling `aspect-ratio` handler from image block. @sneridagh [#450](https://github.com/kitconcept/volto-light-theme/pull/450)
21
+
11
22
  ## 6.0.0-alpha.8 (2024-12-13)
12
23
 
13
24
  ### Bugfix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "6.0.0-alpha.8",
3
+ "version": "6.0.0-alpha.9",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/types/index.d.ts",
@@ -4,14 +4,8 @@ export const teaserSchemaEnhancer = ({ schema, formData, intl }) => {
4
4
  return schema;
5
5
  };
6
6
 
7
- // Not sure why, but it was in the new one, check with blockModel3
8
- // export const gridTeaserDisableStylingSchema = ({ schema, formData, intl }) => {
9
- // schema.fieldsets = schema.fieldsets.filter((item) => item.id !== 'styling');
10
- // return schema;
11
- // };
12
7
  export const gridTeaserDisableStylingSchema = ({ schema, formData, intl }) => {
13
- // Remove all the existing fields from the default schema
14
- schema.properties.styles.schema.fieldsets[0].fields = [];
8
+ schema.fieldsets = schema.fieldsets.filter((item) => item.id !== 'styling');
15
9
  return schema;
16
10
  };
17
11
 
@@ -4,11 +4,15 @@ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
4
4
  import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
5
5
  import { useSelector } from 'react-redux';
6
6
  import { Container } from '@plone/components';
7
+ import cx from 'classnames';
7
8
 
8
9
  type FormState = {
9
10
  content: {
10
11
  data: Content;
11
12
  };
13
+ form: {
14
+ global: Content;
15
+ };
12
16
  navroot: {
13
17
  data: {
14
18
  navroot: Content;
@@ -20,11 +24,22 @@ const FooterLogos = () => {
20
24
  const navroot = useSelector<FormState, Content>(
21
25
  (state) => state.navroot.data.navroot,
22
26
  );
23
- const logos = navroot?.footer_logos;
27
+ const formState = useSelector<FormState, Content>(
28
+ (state) => state.form.global,
29
+ );
30
+ const logos = formState?.footer_logos || navroot?.footer_logos;
31
+ const logosSize = formState?.footer_logos_size || navroot?.footer_logos_size;
32
+ const footer_logos_container_width =
33
+ formState?.footer_logos_container_width ||
34
+ navroot?.footer_logos_container_width;
24
35
 
25
36
  return (
26
- <Container layout>
27
- <ul className="footer-logos">
37
+ <Container className={cx({ [footer_logos_container_width]: 1 })}>
38
+ <ul
39
+ className={cx('footer-logos', {
40
+ [logosSize]: logosSize,
41
+ })}
42
+ >
28
43
  {!isEmpty(logos?.blocks)
29
44
  ? logos.blocks_layout.items.map((itemId) => {
30
45
  const logo = logos.blocks[itemId];
@@ -41,7 +56,7 @@ const FooterLogos = () => {
41
56
  src: '',
42
57
  srcAlt: '',
43
58
  };
44
- if (logo?.href) {
59
+ if (logo?.href?.length > 0) {
45
60
  logoInfo.hrefTitle = logo.href[0]['title'];
46
61
  logoInfo.href = flattenToAppURL(logo.href[0]['@id']);
47
62
  }
@@ -49,6 +64,10 @@ const FooterLogos = () => {
49
64
  logoInfo.logoHref = logo.logo[0]['@id'];
50
65
  logoInfo.srcAlt = logo['alt'];
51
66
  logoInfo.src = `${flattenToAppURL(logoInfo.logoHref)}/${logo.logo[0].image_scales[logo.logo[0].image_field][0].download}`;
67
+ } else if (logo?.logo) {
68
+ logoInfo.logoHref = logo.logo[0]['@id'];
69
+ logoInfo.srcAlt = logo['alt'];
70
+ logoInfo.src = `${flattenToAppURL(logoInfo.logoHref)}/@@images/image`;
52
71
  }
53
72
 
54
73
  if (!logoInfo.src) return null;
@@ -50,14 +50,22 @@ const ButtonsWidget = (props: ButtonsWidgetProps) => {
50
50
  key={action.name}
51
51
  aria-label={actionsInfoMap[action.name][1]}
52
52
  onPress={() => onChange(id, action.style || action.name)}
53
- className={isEqual(value, action.style) ? 'active' : null}
53
+ className={
54
+ isEqual(value, action.style || action.name) ? 'active' : null
55
+ }
54
56
  isDisabled={disabled || isDisabled}
55
57
  >
56
- <Icon
57
- name={actionsInfoMap[action.name][0]}
58
- title={actionsInfoMap[action.name][1] || action.name}
59
- size="24px"
60
- />
58
+ {typeof actionsInfoMap[action.name][0] === 'string' ? (
59
+ <div className="image-sizes-text">
60
+ {actionsInfoMap[action.name][0]}
61
+ </div>
62
+ ) : (
63
+ <Icon
64
+ name={actionsInfoMap[action.name][0]}
65
+ title={actionsInfoMap[action.name][1] || action.name}
66
+ size="24px"
67
+ />
68
+ )}
61
69
  </Button>
62
70
  ))}
63
71
  </div>
@@ -0,0 +1,68 @@
1
+ import { defineMessages, useIntl } from 'react-intl';
2
+ import ButtonsWidget, { type ButtonsWidgetProps } from './ButtonsWidget';
3
+ import type { IntlShape } from 'react-intl';
4
+
5
+ const messages = defineMessages({
6
+ s: {
7
+ id: 'Small',
8
+ defaultMessage: 'Small',
9
+ },
10
+ m: {
11
+ id: 'Medium',
12
+ defaultMessage: 'Medium',
13
+ },
14
+ l: {
15
+ id: 'Large',
16
+ defaultMessage: 'Large',
17
+ },
18
+ });
19
+
20
+ export const defaultActionsInfo = ({ intl }: { intl: IntlShape }) => ({
21
+ s: ['S', intl.formatMessage(messages.s)],
22
+ m: ['M', intl.formatMessage(messages.m)],
23
+ l: ['L', intl.formatMessage(messages.l)],
24
+ });
25
+
26
+ const DEFAULT_ACTIONS = [
27
+ {
28
+ name: 's',
29
+ label: 'Small',
30
+ },
31
+ {
32
+ name: 'm',
33
+ label: 'Medium',
34
+ },
35
+ {
36
+ name: 'l',
37
+ label: 'Large',
38
+ },
39
+ ];
40
+
41
+ const SizeWidget = (props: ButtonsWidgetProps) => {
42
+ const intl = useIntl();
43
+
44
+ const { actions = DEFAULT_ACTIONS, actionsInfoMap, filterActions } = props;
45
+ let filteredActions;
46
+ if (filterActions) {
47
+ filteredActions = actions.filter((action) =>
48
+ filterActions.includes(action.name),
49
+ );
50
+ } else {
51
+ filteredActions = actions;
52
+ }
53
+
54
+ const actionsInfo = {
55
+ ...defaultActionsInfo({ intl }),
56
+ ...actionsInfoMap,
57
+ };
58
+
59
+ return (
60
+ <ButtonsWidget
61
+ {...props}
62
+ actions={filteredActions}
63
+ actionsInfoMap={actionsInfo}
64
+ />
65
+ );
66
+ };
67
+
68
+ export default SizeWidget;
@@ -7,7 +7,7 @@ import { composeSchema } from '@plone/volto/helpers/Extensions';
7
7
  import { findStyleByName } from '@plone/volto/helpers/Blocks/Blocks';
8
8
  import { defaultStylingSchema } from '../components/Blocks/schema';
9
9
  import {
10
- gridTeaserDisableAlignHandlersSchema,
10
+ gridTeaserDisableStylingSchema,
11
11
  teaserSchemaEnhancer,
12
12
  } from '../components/Blocks/Teaser/schema';
13
13
  import { videoBlockSchemaEnhancer } from '../components/Blocks/Video/schema';
@@ -24,7 +24,6 @@ import { SeparatorStylingSchema } from '../components/Blocks/Separator/schema';
24
24
  import {
25
25
  imageBlockSchemaEnhancer,
26
26
  standAloneImageBlockSchemaEnhancer,
27
- aspectRatioSchemaEnhancer,
28
27
  } from '../components/Blocks/Image/schema';
29
28
  import { ImageBlockDataAdapter } from '../components/Blocks/Image/adapter';
30
29
 
@@ -136,6 +135,7 @@ export default function install(config: ConfigType) {
136
135
  if (!data['@type']) return {};
137
136
  if (data.theme) {
138
137
  const blockConfig = config.blocks.blocksConfig[data['@type']];
138
+ if (!blockConfig) return {};
139
139
  const blockStyleDefinitions =
140
140
  // We look up for the blockThemes in the block's config, then in the global config
141
141
  // We keep `colors` for BBB, but `themes` should be used
@@ -246,14 +246,13 @@ export default function install(config: ConfigType) {
246
246
  config.blocks.blocksConfig.gridBlock.blocksConfig.image.schemaEnhancer =
247
247
  composeSchema(
248
248
  imageBlockSchemaEnhancer,
249
- aspectRatioSchemaEnhancer,
250
249
  gridImageDisableSizeAndPositionHandlersSchema,
251
250
  );
252
251
  config.blocks.blocksConfig.gridBlock.blocksConfig.image.dataAdapter =
253
252
  ImageBlockDataAdapter;
254
253
 
255
254
  config.blocks.blocksConfig.gridBlock.blocksConfig.teaser.schemaEnhancer =
256
- composeSchema(gridTeaserDisableAlignHandlersSchema, teaserSchemaEnhancer);
255
+ composeSchema(teaserSchemaEnhancer, gridTeaserDisableStylingSchema);
257
256
 
258
257
  config.blocks.blocksConfig.gridBlock.blocksConfig.listing.allowed_headline_tags =
259
258
  [['h2', 'h2']];
@@ -6,6 +6,7 @@ import BlockAlignmentWidget from '../components/Widgets/BlockAlignmentWidget';
6
6
  import ColorPickerWidget from '../components/Widgets/ColorPickerWidget';
7
7
  import FooterLogosWidget from '../components/Widgets/FooterLogosWidget';
8
8
  import FooterLinksWidget from '../components/Widgets/FooterLinksWidget';
9
+ import SizeWidget from '../components/Widgets/SizeWidget';
9
10
 
10
11
  declare module '@plone/types' {
11
12
  export interface WidgetsConfigByWidget {
@@ -15,6 +16,7 @@ declare module '@plone/types' {
15
16
  themingColorPicker: typeof ThemingColorPicker;
16
17
  footerLogos: typeof FooterLogosWidget;
17
18
  footerLinks: typeof FooterLinksWidget;
19
+ sizeWidget: React.ComponentType<any>;
18
20
  }
19
21
  }
20
22
 
@@ -26,6 +28,7 @@ export default function install(config: ConfigType) {
26
28
  config.widgets.widget.themingColorPicker = ThemingColorPicker;
27
29
  config.widgets.widget.footerLogos = FooterLogosWidget;
28
30
  config.widgets.widget.footerLinks = FooterLinksWidget;
31
+ config.widgets.widget.sizeWidget = SizeWidget;
29
32
 
30
33
  return config;
31
34
  }
package/src/index.ts CHANGED
@@ -30,6 +30,8 @@ defineMessages({
30
30
  declare module '@plone/types' {
31
31
  export interface Content {
32
32
  footer_logos: BlocksData;
33
+ footer_logos_container_width: string;
34
+ footer_logos_size: string;
33
35
  }
34
36
  }
35
37
 
@@ -6,6 +6,10 @@
6
6
  @include layout-container-width;
7
7
  }
8
8
 
9
+ &.default {
10
+ @include default-container-width;
11
+ }
12
+
9
13
  &.narrow {
10
14
  @include narrow-container-width;
11
15
  }
@@ -4,26 +4,24 @@
4
4
 
5
5
  ul.footer-logos {
6
6
  display: grid;
7
+ align-items: center;
7
8
  justify-content: center;
8
9
  padding: $pre-footer-vertical-spacing 0;
9
10
  padding-left: 0;
10
11
  margin-top: 0;
11
12
  margin-bottom: $spacing-medium;
12
- gap: 20px;
13
- grid-template-columns: repeat(3, 1fr);
13
+ gap: 60px 20px;
14
+ grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
14
15
  list-style: none;
15
16
 
16
- img {
17
- max-width: 100%;
17
+ &.l img {
18
+ max-width: min(100%, 240px);
19
+ max-height: 165px;
18
20
  }
19
21
 
20
- li.item:nth-child(3n + 1) {
21
- /* Targets 1st, 4th, 7th, etc. */
22
- justify-self: start;
23
- }
24
- li.item:nth-child(3n + 3) {
25
- /* Targets 3rd, 6th, 9th, etc. */
26
- justify-self: end;
22
+ &.s img {
23
+ max-width: min(100%, 175px);
24
+ max-height: 120px;
27
25
  }
28
26
  }
29
27
 
@@ -1,4 +1,5 @@
1
- #sidebar-properties {
1
+ #sidebar-properties,
2
+ #sidebar-metadata {
2
3
  .field.widget {
3
4
  .buttons {
4
5
  display: flex;