@kitconcept/volto-light-theme 7.6.7 → 7.8.0

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.
@@ -0,0 +1,81 @@
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import { EmblaCarouselType } from 'embla-carousel';
3
+ import type { ComponentPropsWithRef } from 'react';
4
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
5
+ import rightArrowSVG from '@plone/volto/icons/right-key.svg';
6
+ import leftArrowSVG from '@plone/volto/icons/left-key.svg';
7
+
8
+ type UsePrevNextButtonsType = {
9
+ prevBtnDisabled: boolean;
10
+ nextBtnDisabled: boolean;
11
+ onPrevButtonClick: () => void;
12
+ onNextButtonClick: () => void;
13
+ };
14
+
15
+ export const usePrevNextButtons = (
16
+ emblaApi: EmblaCarouselType | undefined,
17
+ ): UsePrevNextButtonsType => {
18
+ const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
19
+ const [nextBtnDisabled, setNextBtnDisabled] = useState(true);
20
+
21
+ const onPrevButtonClick = useCallback(() => {
22
+ if (!emblaApi) return;
23
+ emblaApi.scrollPrev();
24
+ }, [emblaApi]);
25
+
26
+ const onNextButtonClick = useCallback(() => {
27
+ if (!emblaApi) return;
28
+ emblaApi.scrollNext();
29
+ }, [emblaApi]);
30
+
31
+ const onSelect = useCallback((emblaApi: EmblaCarouselType) => {
32
+ setPrevBtnDisabled(!emblaApi.canScrollPrev());
33
+ setNextBtnDisabled(!emblaApi.canScrollNext());
34
+ }, []);
35
+
36
+ useEffect(() => {
37
+ if (!emblaApi) return;
38
+
39
+ onSelect(emblaApi);
40
+ emblaApi.on('reInit', onSelect).on('select', onSelect);
41
+ }, [emblaApi, onSelect]);
42
+
43
+ return {
44
+ prevBtnDisabled,
45
+ nextBtnDisabled,
46
+ onPrevButtonClick,
47
+ onNextButtonClick,
48
+ };
49
+ };
50
+
51
+ type PropType = ComponentPropsWithRef<'button'>;
52
+
53
+ export const PrevButton: React.FC<PropType> = (props) => {
54
+ const { children, ...restProps } = props;
55
+
56
+ return (
57
+ <button
58
+ className="embla__button embla__button--prev"
59
+ type="button"
60
+ {...restProps}
61
+ >
62
+ <Icon name={leftArrowSVG} size="48px" />
63
+ {children}
64
+ </button>
65
+ );
66
+ };
67
+
68
+ export const NextButton: React.FC<PropType> = (props) => {
69
+ const { children, ...restProps } = props;
70
+
71
+ return (
72
+ <button
73
+ className="embla__button embla__button--next"
74
+ type="button"
75
+ {...restProps}
76
+ >
77
+ <Icon name={rightArrowSVG} size="48px" />
78
+ {children}
79
+ </button>
80
+ );
81
+ };
@@ -0,0 +1,76 @@
1
+ import { useLiveData } from '@kitconcept/volto-light-theme/helpers/useLiveData';
2
+ import { IconLinkListTemplate } from '@kitconcept/volto-light-theme/primitives/IconLinkList';
3
+ import type { StickyMenuSettings } from '../../types';
4
+ import useEmblaCarousel from 'embla-carousel-react';
5
+ import type { EmblaOptionsType } from 'embla-carousel';
6
+
7
+ import {
8
+ usePrevNextButtons,
9
+ PrevButton,
10
+ NextButton,
11
+ } from './MobileCarouselArrowButton';
12
+ import type { Content } from '@plone/types';
13
+
14
+ const MobileStickyMenu = ({ content }: { content: Content }) => {
15
+ const options: EmblaOptionsType = {};
16
+ const [emblaRef, emblaApi] = useEmblaCarousel(options);
17
+ const {
18
+ prevBtnDisabled,
19
+ nextBtnDisabled,
20
+ onPrevButtonClick,
21
+ onNextButtonClick,
22
+ } = usePrevNextButtons(emblaApi);
23
+ const showMobileStickyMenu = useLiveData<StickyMenuSettings['sticky_menu']>(
24
+ content,
25
+ 'kitconcept.sticky_menu',
26
+ 'enable_mobile_sticky_menu',
27
+ );
28
+ const menuData = useLiveData<StickyMenuSettings['sticky_menu']>(
29
+ content,
30
+ 'kitconcept.sticky_menu',
31
+ 'sticky_menu',
32
+ );
33
+
34
+ const sticky_menu_color = useLiveData<
35
+ StickyMenuSettings['sticky_menu_color']
36
+ >(content, 'kitconcept.sticky_menu', 'sticky_menu_color');
37
+
38
+ const sticky_menu_foreground_color = useLiveData<
39
+ StickyMenuSettings['sticky_menu_foreground_color']
40
+ >(content, 'kitconcept.sticky_menu', 'sticky_menu_foreground_color');
41
+
42
+ if (!showMobileStickyMenu) {
43
+ return null;
44
+ }
45
+
46
+ return (
47
+ <div
48
+ className="mobile-sticky-menu"
49
+ role="navigation"
50
+ aria-label="Mobile Sticky menu"
51
+ style={
52
+ {
53
+ '--sticky-menu-color': sticky_menu_color,
54
+ '--sticky-menu-foreground-color': sticky_menu_foreground_color,
55
+ } as React.CSSProperties
56
+ }
57
+ >
58
+ <section className="embla">
59
+ <div className="embla__viewport" ref={emblaRef}>
60
+ <div className="embla__container">
61
+ {menuData &&
62
+ menuData.map((item) => (
63
+ <ul className="embla__slide" key={item['@id']}>
64
+ <IconLinkListTemplate item={item} />
65
+ </ul>
66
+ ))}
67
+ </div>
68
+ </div>
69
+ <PrevButton onClick={onPrevButtonClick} disabled={prevBtnDisabled} />
70
+ <NextButton onClick={onNextButtonClick} disabled={nextBtnDisabled} />
71
+ </section>
72
+ </div>
73
+ );
74
+ };
75
+
76
+ export default MobileStickyMenu;
@@ -73,14 +73,14 @@ const EventView = (props) => {
73
73
  return (
74
74
  <Container id="page-document" className="view-wrapper event-view">
75
75
  <div className="dates">
76
- {content?.head_title && (
77
- <span className="head-title"> {content?.head_title}</span>
78
- )}{' '}
79
76
  {formattedDate ? (
80
77
  <span className="day" suppressHydrationWarning>
81
78
  {formattedDate}
82
79
  </span>
83
- ) : null}
80
+ ) : null}{' '}
81
+ {content?.head_title && (
82
+ <span className="head-title"> {content?.head_title}</span>
83
+ )}
84
84
  </div>
85
85
  {hasBlocksData(content) ? (
86
86
  <>
@@ -21,9 +21,6 @@ const NewsItemView = ({ content }) => {
21
21
  return (
22
22
  <Container id="page-document" className="view-wrapper newsitem-view">
23
23
  <div className="dates">
24
- {content?.head_title && (
25
- <span className="head-title"> {content?.head_title}</span>
26
- )}{' '}
27
24
  {content.effective ? (
28
25
  <FormattedDate
29
26
  key="day"
@@ -35,7 +32,10 @@ const NewsItemView = ({ content }) => {
35
32
  }}
36
33
  className="day"
37
34
  />
38
- ) : null}
35
+ ) : null}{' '}
36
+ {content?.head_title && (
37
+ <span className="head-title"> {content?.head_title}</span>
38
+ )}
39
39
  </div>
40
40
  <RenderBlocks content={content} />
41
41
  </Container>
@@ -31,6 +31,8 @@ import { AccordionSchemaEnhancer } from '../components/Blocks/Accordion/schema';
31
31
 
32
32
  import { searchBlockSchemaEnhancer } from '../components/Blocks/Search/schema';
33
33
 
34
+ import { BannerStylingSchema } from '../components/Blocks/Banner/schema';
35
+
34
36
  import gridSVG from '../icons/block_icn_grid.svg';
35
37
  import accordionSVG from '../icons/block_icn_accordion.svg';
36
38
  import descriptionSVG from '@plone/volto/icons/description.svg';
@@ -61,6 +63,7 @@ declare module '@plone/types' {
61
63
  hero: BlockConfigBase;
62
64
  slateTable: BlockConfigBase;
63
65
  eventCalendar: BlockConfigBase;
66
+ banner: BlockConfigBase;
64
67
  }
65
68
  export interface BlockConfigBase {
66
69
  themes?: StyleDefinition[];
@@ -365,6 +368,11 @@ export default function install(config: ConfigType) {
365
368
  schemaEnhancer: defaultStylingSchema,
366
369
  };
367
370
 
371
+ config.blocks.blocksConfig.banner = {
372
+ ...config.blocks.blocksConfig.banner,
373
+ schemaEnhancer: BannerStylingSchema,
374
+ };
375
+
368
376
  config.blocks.blocksConfig.search = {
369
377
  ...config.blocks.blocksConfig.search,
370
378
  schemaEnhancer: composeSchema(
@@ -5,6 +5,7 @@ import FollowUsLogoAndLinks from '../components/Footer/slots/FollowUsLogoAndLink
5
5
  import Colophon from '../components/Footer/slots/Colophon';
6
6
  import CoreFooter from '../components/Footer/slots/CoreFooter';
7
7
  import StickyMenu from '../components/StickyMenu/StickyMenu';
8
+ import MobileStickyMenu from '../components/StickyMenu/MobileStickyMenu';
8
9
  import Anontools from '../components/Anontools/Anontools';
9
10
  import type { Content } from '@plone/types';
10
11
 
@@ -57,5 +58,11 @@ export default function install(config: ConfigType) {
57
58
  component: Colophon,
58
59
  });
59
60
 
61
+ config.registerSlotComponent({
62
+ name: 'MobileStickyMenu',
63
+ slot: 'preFooter',
64
+ component: MobileStickyMenu,
65
+ });
66
+
60
67
  return config;
61
68
  }
@@ -6,6 +6,58 @@ type IconLinkListProps = {
6
6
  iconLinks: Array<iconLink>;
7
7
  };
8
8
 
9
+ export const IconLinkListTemplate = ({ item }) => {
10
+ const itemInfo: {
11
+ title: string;
12
+ hrefTitle: string;
13
+ href: string;
14
+ itemHref: string;
15
+ src: string;
16
+ srcAlt: string;
17
+ } = {
18
+ title: '',
19
+ hrefTitle: '',
20
+ href: '',
21
+ itemHref: '',
22
+ src: '',
23
+ srcAlt: '',
24
+ };
25
+
26
+ // If the item has title, always set it
27
+ itemInfo.title = item ? item?.title || item?.href?.[0]?.['title'] || '' : '';
28
+ if (item?.href?.length > 0) {
29
+ itemInfo.title = item.title || item.href[0]['title'];
30
+ itemInfo.href = flattenToAppURL(item.href[0]['@id']);
31
+ }
32
+ if (item?.icon && item.icon[0]?.image_scales) {
33
+ itemInfo.itemHref = item.icon[0]['@id'];
34
+ itemInfo.srcAlt = item['alt'];
35
+ itemInfo.src = `${flattenToAppURL(itemInfo.itemHref)}/${item.icon[0].image_scales[item.icon[0].image_field][0].download}`;
36
+ } else if (item?.icon && item.icon[0]) {
37
+ itemInfo.itemHref = item.icon[0]['@id'];
38
+ itemInfo.srcAlt = item['alt'];
39
+ itemInfo.src = `${flattenToAppURL(itemInfo.itemHref)}/@@images/image`;
40
+ }
41
+
42
+ if (!itemInfo.src) return null;
43
+ return (
44
+ <li className="item" key={item['@id']}>
45
+ {/* @ts-ignore */}
46
+ <ConditionalLink
47
+ condition={itemInfo.href}
48
+ to={itemInfo.href}
49
+ title={itemInfo.hrefTitle || itemInfo.srcAlt}
50
+ openLinkInNewTab={item.openInNewTab}
51
+ >
52
+ <div className="image-wrapper">
53
+ <img src={itemInfo.src} alt={itemInfo.srcAlt || ''} />
54
+ </div>
55
+ <span className="title">{itemInfo.title}</span>
56
+ </ConditionalLink>
57
+ </li>
58
+ );
59
+ };
60
+
9
61
  const IconLinkList = (props: IconLinkListProps) => {
10
62
  const { iconLinks } = props;
11
63
 
@@ -13,58 +65,7 @@ const IconLinkList = (props: IconLinkListProps) => {
13
65
  <ul>
14
66
  {iconLinks && Array.isArray(iconLinks)
15
67
  ? iconLinks.map((item) => {
16
- const itemInfo: {
17
- title: string;
18
- hrefTitle: string;
19
- href: string;
20
- itemHref: string;
21
- src: string;
22
- srcAlt: string;
23
- } = {
24
- title: '',
25
- hrefTitle: '',
26
- href: '',
27
- itemHref: '',
28
- src: '',
29
- srcAlt: '',
30
- };
31
-
32
- // If the item has title, always set it
33
- itemInfo.title = item
34
- ? item?.title || item?.href?.[0]?.['title'] || ''
35
- : '';
36
- if (item?.href?.length > 0) {
37
- itemInfo.title = item.title || item.href[0]['title'];
38
- itemInfo.href = flattenToAppURL(item.href[0]['@id']);
39
- }
40
- if (item?.icon && item.icon[0]?.image_scales) {
41
- itemInfo.itemHref = item.icon[0]['@id'];
42
- itemInfo.srcAlt = item['alt'];
43
- itemInfo.src = `${flattenToAppURL(itemInfo.itemHref)}/${item.icon[0].image_scales[item.icon[0].image_field][0].download}`;
44
- } else if (item?.icon && item.icon[0]) {
45
- itemInfo.itemHref = item.icon[0]['@id'];
46
- itemInfo.srcAlt = item['alt'];
47
- itemInfo.src = `${flattenToAppURL(itemInfo.itemHref)}/@@images/image`;
48
- }
49
-
50
- if (!itemInfo.src) return null;
51
-
52
- return (
53
- <li className="item" key={item['@id']}>
54
- {/* @ts-ignore */}
55
- <ConditionalLink
56
- condition={itemInfo.href}
57
- to={itemInfo.href}
58
- title={itemInfo.hrefTitle || itemInfo.srcAlt}
59
- openLinkInNewTab={item.openInNewTab}
60
- >
61
- <div className="image-wrapper">
62
- <img src={itemInfo.src} alt={itemInfo.srcAlt || ''} />
63
- </div>
64
- <span>{itemInfo.title}</span>
65
- </ConditionalLink>
66
- </li>
67
- );
68
+ return <IconLinkListTemplate item={item} key={item['@id']} />;
68
69
  })
69
70
  : null}
70
71
  </ul>
@@ -407,6 +407,14 @@
407
407
  }
408
408
  }
409
409
 
410
+ // Banner block, if next block has different bgcolor it snaps to the bottom
411
+ #page-document
412
+ .blocks-group-wrapper:has(
413
+ :last-child.banner.next--has--different--backgroundColor
414
+ ) {
415
+ padding-bottom: 0;
416
+ }
417
+
410
418
  // Color map
411
419
  @mixin use-theme-colors() {
412
420
  #page-document {
@@ -1269,6 +1277,9 @@
1269
1277
  color: var(--header-foreground);
1270
1278
  }
1271
1279
  }
1280
+ .language-selector a {
1281
+ color: var(--header-foreground);
1282
+ }
1272
1283
  }
1273
1284
 
1274
1285
  // Navigation
@@ -1,3 +1,12 @@
1
+ @mixin day-with-head-title-separator {
2
+ .day:has(+ .head-title) {
3
+ &::after {
4
+ margin-left: 8px;
5
+ content: '|';
6
+ }
7
+ }
8
+ }
9
+
1
10
  .ui.basic.segment.content-area {
2
11
  // We cancel the padding and margin from the segment
3
12
  // allowing the content elements to be the ones that push for
@@ -18,6 +27,8 @@
18
27
  #page-document .dates {
19
28
  @include default-container-width();
20
29
  @include adjustMarginsToContainer($default-container-width);
30
+ @include day-with-head-title-separator();
31
+
21
32
  margin-top: $spacing-medium;
22
33
  margin-bottom: $spacing-medium;
23
34
  color: var(--primary-foreground-color);
@@ -27,13 +38,6 @@
27
38
  text-transform: uppercase;
28
39
  }
29
40
 
30
- .head-title:has(+ .day) {
31
- &::after {
32
- margin-left: 8px;
33
- content: '|';
34
- }
35
- }
36
-
37
41
  @container (max-width: #{$tablet-breakpoint} ) {
38
42
  .day,
39
43
  .head-title {
@@ -91,6 +95,7 @@
91
95
  }
92
96
  }
93
97
  .dates {
98
+ @include day-with-head-title-separator();
94
99
  margin-top: $spacing-medium;
95
100
  margin-bottom: $spacing-medium;
96
101
  color: var(--primary-foreground-color);
@@ -103,12 +108,6 @@
103
108
  letter-spacing: 1px;
104
109
  text-transform: uppercase;
105
110
  }
106
- .head-title {
107
- &::after {
108
- margin-left: 8px;
109
- content: '|';
110
- }
111
- }
112
111
  @container (max-width: #{$tablet-breakpoint} ) {
113
112
  .day,
114
113
  .head-title {
@@ -343,6 +343,7 @@
343
343
  .main-footer + .post-footer {
344
344
  background-color: var(--primary-color, $white);
345
345
  color: var(--primary-foreground-color, $black);
346
+ --social-network-icon-color-main: var(--primary-foreground-color, $black);
346
347
  }
347
348
  }
348
349
 
@@ -0,0 +1,92 @@
1
+ .mobile-sticky-menu {
2
+ position: fixed;
3
+ z-index: 100;
4
+ bottom: 0;
5
+ display: flex;
6
+ display: none;
7
+ width: 100%;
8
+ height: 100px;
9
+ flex-direction: column;
10
+ background-color: var(--sticky-menu-color, #555);
11
+ @media only screen and (max-width: $narrow-container-width) {
12
+ display: block;
13
+ }
14
+
15
+ .embla {
16
+ position: relative;
17
+ --slide-size: 33%;
18
+
19
+ .embla__button {
20
+ display: flex;
21
+ height: 100px;
22
+ align-items: center;
23
+ padding: 0px;
24
+ border: none;
25
+ background-color: transparent;
26
+ color: var(--sticky-menu-foreground-color, #fff);
27
+ cursor: pointer;
28
+ font-size: 30px;
29
+ }
30
+ .embla__button--prev {
31
+ position: absolute;
32
+ top: 0px;
33
+ left: -5px;
34
+ }
35
+ .embla__button--next {
36
+ position: absolute;
37
+ top: 0px;
38
+ right: -5px;
39
+ }
40
+ .embla__viewport {
41
+ position: relative;
42
+ display: inline-block;
43
+ overflow: hidden;
44
+ width: 85%;
45
+
46
+ .embla__container {
47
+ display: flex;
48
+ height: 100px;
49
+ touch-action: pan-y pinch-zoom;
50
+ touch-action: pan-x;
51
+
52
+ .embla__slide {
53
+ min-width: 0;
54
+ flex: 0 0 var(--slide-size);
55
+ padding: 0px;
56
+ margin: 0px;
57
+ transform: translate3d(0, 0, 0);
58
+
59
+ .image-wrapper {
60
+ display: block;
61
+ width: 65px;
62
+ height: 65px;
63
+ img {
64
+ display: block;
65
+ width: 100%;
66
+ height: 100%;
67
+ }
68
+ }
69
+
70
+ li {
71
+ list-style: none;
72
+ }
73
+
74
+ span {
75
+ display: block;
76
+ color: var(--sticky-menu-foreground-color, #fff);
77
+ font-size: 10px;
78
+ font-weight: 700;
79
+ line-height: 12px;
80
+ }
81
+
82
+ a {
83
+ display: flex;
84
+ flex-flow: column;
85
+ align-items: center;
86
+ padding: 5px 10px 15px 10px;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,3 @@
1
+ .block.banner.has--block-width--layout {
2
+ max-width: 100% !important;
3
+ }
@@ -131,6 +131,7 @@
131
131
  border-bottom: none;
132
132
  }
133
133
  &.next--is--__button {
134
+ margin-bottom: 0 !important;
134
135
  .card-inner,
135
136
  .teaser-item.default {
136
137
  padding-bottom: 40px;
@@ -37,7 +37,9 @@
37
37
  @import 'blocks/rss';
38
38
  @import 'blocks/eventSearch';
39
39
  @import 'blocks/error-boundary';
40
+ @import 'blocks/banner';
40
41
  @import 'sticky-menu';
42
+ @import 'mobile-sticky-menu';
41
43
  @import 'card';
42
44
  @import 'insets';
43
45
  @import 'person';
@@ -4,7 +4,7 @@ body.cms-ui .sticky-menu {
4
4
 
5
5
  .sticky-menu {
6
6
  position: fixed;
7
- z-index: 11;
7
+ z-index: 13;
8
8
  top: 50vh;
9
9
  right: 0;
10
10
  transform: translateY(-50%);
package/src/types.d.ts CHANGED
@@ -81,6 +81,7 @@ export type StickyMenuSettings = {
81
81
  sticky_menu: Array<iconLink>;
82
82
  sticky_menu_color: string;
83
83
  sticky_menu_foreground_color: string;
84
+ enable_mobile_sticky_menu: boolean;
84
85
  };
85
86
 
86
87
  export type PloneGobrSocialMediaSettings = {