@uniformdev/csk-components 6.0.123-alpha.1 → 6.1.63-alpha.1
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/README.md +74 -81
- package/dist/ThemeSwitcher-EUDUX3QI.mjs +1 -0
- package/dist/accordion-item-7IKL6Z6Q.mjs +1 -0
- package/dist/accordion-item-MORC2F2Q.mjs +1 -0
- package/dist/banner-WOYK426U.mjs +1 -0
- package/dist/carousel-ALNEGOPM.mjs +1 -0
- package/dist/carousel-HKYR3ZBB.mjs +1 -0
- package/dist/chunk-27WJUZYR.mjs +1 -0
- package/dist/chunk-3JU2XCD2.mjs +1 -0
- package/dist/chunk-47YB4P2Q.mjs +1 -0
- package/dist/chunk-6CKVLOIH.mjs +1 -0
- package/dist/{chunk-PMMAALCQ.mjs → chunk-AOFJCDRO.mjs} +1 -1
- package/dist/{chunk-2BMAPB63.mjs → chunk-AWTML4I7.mjs} +1 -1
- package/dist/chunk-CZ4X5ZBK.mjs +1 -0
- package/dist/chunk-D673IM2U.mjs +1 -0
- package/dist/chunk-I6SUO5WR.mjs +1 -0
- package/dist/chunk-JT77BVIX.mjs +1 -0
- package/dist/chunk-LPAOEOU4.mjs +1 -0
- package/dist/chunk-MKOFM4XK.mjs +1 -0
- package/dist/chunk-NKINOJY6.mjs +1 -0
- package/dist/chunk-OKUDTS22.mjs +1 -0
- package/dist/chunk-OL6JBPZ4.mjs +1 -0
- package/dist/chunk-OY6ZJNCE.mjs +1 -0
- package/dist/chunk-PLKWUEFW.mjs +1 -0
- package/dist/chunk-QPQGRQKI.mjs +1 -0
- package/dist/chunk-VWWXSA5H.mjs +1 -0
- package/dist/chunk-XKCRANRQ.mjs +1 -0
- package/dist/chunk-XYU3TGOU.mjs +1 -0
- package/dist/chunk-Y337A266.mjs +7 -0
- package/dist/chunk-YQYDZJ65.mjs +1 -0
- package/dist/chunk-ZAHWFLY4.mjs +1 -0
- package/dist/{chunk-V4EBWEG4.mjs → chunk-ZWDCDE5W.mjs} +1 -1
- package/dist/components/canvas/emptyPlaceholders.d.mts +5 -4
- package/dist/components/canvas/emptyPlaceholders.mjs +1 -1
- package/dist/components/canvas/index.d.mts +4 -648
- package/dist/components/canvas/index.mjs +1 -1
- package/dist/components/canvas/serverClient.d.mts +694 -0
- package/dist/components/canvas/serverClient.mjs +1 -0
- package/dist/components/canvas/serverOnly.d.mts +41 -0
- package/dist/components/canvas/serverOnly.mjs +1 -0
- package/dist/components/ui/index.d.mts +24 -33
- package/dist/components/ui/index.mjs +1 -1
- package/dist/content/components/canvas/Accordion/accordion.tsx +8 -7
- package/dist/content/components/canvas/Accordion/index.tsx +2 -2
- package/dist/content/components/canvas/AccordionItem/accordion-item.tsx +9 -7
- package/dist/content/components/canvas/AccordionItem/index.tsx +4 -6
- package/dist/content/components/canvas/Badge/badge.tsx +12 -5
- package/dist/content/components/canvas/Badge/index.tsx +2 -3
- package/dist/content/components/canvas/Badge/style-utils.ts +6 -6
- package/dist/content/components/canvas/Banner/banner.tsx +24 -36
- package/dist/content/components/canvas/Banner/index.tsx +7 -11
- package/dist/content/components/canvas/Breadcrumbs/breadcrumbs.tsx +21 -22
- package/dist/content/components/canvas/Breadcrumbs/index.tsx +4 -7
- package/dist/content/components/canvas/Button/button.tsx +19 -11
- package/dist/content/components/canvas/Button/index.tsx +3 -5
- package/dist/content/components/canvas/Card/card.tsx +9 -9
- package/dist/content/components/canvas/Card/index.tsx +3 -3
- package/dist/content/components/canvas/Carousel/carousel.tsx +9 -7
- package/dist/content/components/canvas/Carousel/index.tsx +4 -4
- package/dist/content/components/canvas/Container/container.tsx +7 -6
- package/dist/content/components/canvas/Container/index.tsx +3 -3
- package/dist/content/components/canvas/CookieConsent/cookie-consent.tsx +126 -0
- package/dist/content/components/canvas/CookieConsent/empty-placeholder.tsx +12 -0
- package/dist/content/components/canvas/CookieConsent/index.tsx +26 -0
- package/dist/content/components/canvas/Countdown/countdown.tsx +9 -7
- package/dist/content/components/canvas/Countdown/index.tsx +2 -3
- package/dist/content/components/canvas/DemoHero/atoms.tsx +29 -32
- package/dist/content/components/canvas/DemoHero/columns-variant.tsx +4 -4
- package/dist/content/components/canvas/DemoHero/default-variant.tsx +4 -4
- package/dist/content/components/canvas/DemoHero/demo-hero.tsx +41 -18
- package/dist/content/components/canvas/DemoHero/fixed-hero.tsx +13 -6
- package/dist/content/components/canvas/DemoHero/flexible-hero.tsx +8 -2
- package/dist/content/components/canvas/DemoHero/index.tsx +3 -4
- package/dist/content/components/canvas/Divider/divider.tsx +5 -2
- package/dist/content/components/canvas/Divider/index.tsx +2 -2
- package/dist/content/components/canvas/Flex/flex.tsx +9 -6
- package/dist/content/components/canvas/Flex/index.tsx +6 -6
- package/dist/content/components/canvas/FlexItem/flex-item.tsx +7 -4
- package/dist/content/components/canvas/FlexItem/index.tsx +4 -5
- package/dist/content/components/canvas/Footer/footer.tsx +9 -8
- package/dist/content/components/canvas/Footer/index.tsx +2 -3
- package/dist/content/components/canvas/Grid/grid.tsx +9 -7
- package/dist/content/components/canvas/Grid/index.tsx +5 -5
- package/dist/content/components/canvas/GridItem/grid-item.tsx +10 -8
- package/dist/content/components/canvas/GridItem/index.tsx +5 -5
- package/dist/content/components/canvas/Header/header.tsx +10 -7
- package/dist/content/components/canvas/Header/index.tsx +2 -3
- package/dist/content/components/canvas/IconLabel/icon-label.tsx +16 -8
- package/dist/content/components/canvas/IconLabel/index.tsx +4 -5
- package/dist/content/components/canvas/Image/image.tsx +13 -7
- package/dist/content/components/canvas/Image/index.tsx +2 -3
- package/dist/content/components/canvas/ImageGallery/empty-placeholder.tsx +1 -1
- package/dist/content/components/canvas/ImageGallery/gallery-inner.tsx +6 -6
- package/dist/content/components/canvas/ImageGallery/image-gallery.tsx +20 -33
- package/dist/content/components/canvas/ImageGallery/index.tsx +11 -12
- package/dist/content/components/canvas/Link/index.tsx +2 -3
- package/dist/content/components/canvas/Link/link.tsx +7 -4
- package/dist/content/components/canvas/Modal/index.tsx +2 -2
- package/dist/content/components/canvas/Modal/modal.tsx +9 -10
- package/dist/content/components/canvas/NavigationFlyout/desktop.tsx +9 -13
- package/dist/content/components/canvas/NavigationFlyout/index.tsx +21 -3
- package/dist/content/components/canvas/NavigationFlyout/mobile.tsx +10 -13
- package/dist/content/components/canvas/NavigationFlyout/{navigation-flyout.tsx → navigation-flyout-client.tsx} +26 -20
- package/dist/content/components/canvas/NavigationGroup/desktop.tsx +7 -10
- package/dist/content/components/canvas/NavigationGroup/index.tsx +20 -3
- package/dist/content/components/canvas/NavigationGroup/mobile.tsx +9 -8
- package/dist/content/components/canvas/NavigationGroup/{navigation-group.tsx → navigation-group-client.tsx} +21 -18
- package/dist/content/components/canvas/NavigationLink/index.tsx +2 -4
- package/dist/content/components/canvas/NavigationLink/navigation-link.tsx +12 -9
- package/dist/content/components/canvas/Page/index.tsx +7 -7
- package/dist/content/components/canvas/Page/page.tsx +9 -18
- package/dist/content/components/canvas/Review/default-variant.tsx +2 -2
- package/dist/content/components/canvas/Review/empty-placeholder.tsx +6 -3
- package/dist/content/components/canvas/Review/index.tsx +6 -6
- package/dist/content/components/canvas/Review/multi-column-variant.tsx +2 -2
- package/dist/content/components/canvas/Review/review.tsx +11 -11
- package/dist/content/components/canvas/RichText/index.tsx +7 -6
- package/dist/content/components/canvas/RichText/rich-text.tsx +23 -6
- package/dist/content/components/canvas/Section/columns-variant.tsx +4 -4
- package/dist/content/components/canvas/Section/default-variant.tsx +6 -6
- package/dist/content/components/canvas/Section/empty-placeholder.tsx +5 -2
- package/dist/content/components/canvas/Section/index.tsx +2 -2
- package/dist/content/components/canvas/Section/section.tsx +11 -12
- package/dist/content/components/canvas/SimpleFooter/index.tsx +16 -0
- package/dist/content/components/canvas/SimpleFooter/simple-footer.tsx +85 -0
- package/dist/content/components/canvas/SimpleHeader/index.tsx +22 -0
- package/dist/content/components/canvas/SimpleHeader/simple-header.tsx +63 -0
- package/dist/content/components/canvas/Spacer/index.tsx +2 -2
- package/dist/content/components/canvas/Spacer/spacer.tsx +5 -2
- package/dist/content/components/canvas/Tab/index.tsx +2 -3
- package/dist/content/components/canvas/Tab/tab.tsx +6 -5
- package/dist/content/components/canvas/Table/index.tsx +2 -2
- package/dist/content/components/canvas/Table/table.tsx +8 -7
- package/dist/content/components/canvas/TableCustomCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableCustomCell/table-custom-cell.tsx +7 -4
- package/dist/content/components/canvas/TableDataCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableDataCell/table-data-cell.tsx +7 -4
- package/dist/content/components/canvas/TableHeaderCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableHeaderCell/table-header-cell.tsx +7 -4
- package/dist/content/components/canvas/TableRow/index.tsx +5 -3
- package/dist/content/components/canvas/TableRow/table-row.tsx +6 -3
- package/dist/content/components/canvas/Tabs/index.tsx +7 -7
- package/dist/content/components/canvas/Tabs/style-utils.ts +12 -11
- package/dist/content/components/canvas/Tabs/tabs.tsx +44 -42
- package/dist/content/components/canvas/Testimonial/default-variant.tsx +7 -7
- package/dist/content/components/canvas/Testimonial/index.tsx +2 -2
- package/dist/content/components/canvas/Testimonial/testimonial.tsx +11 -13
- package/dist/content/components/canvas/Testimonial/with-large-avatar-variant.tsx +7 -7
- package/dist/content/components/canvas/Testimonial/with-overlapping-image-variant.tsx +7 -7
- package/dist/content/components/canvas/Text/index.tsx +2 -3
- package/dist/content/components/canvas/Text/text.tsx +21 -15
- package/dist/content/components/canvas/ThemeSwitcher/index.tsx +2 -2
- package/dist/content/components/canvas/ThemeSwitcher/theme-switcher.tsx +6 -3
- package/dist/content/components/canvas/Video/index.tsx +2 -3
- package/dist/content/components/canvas/Video/placeholder.tsx +1 -1
- package/dist/content/components/canvas/Video/video.tsx +8 -5
- package/dist/content/components/ui/Banner/banner.tsx +47 -0
- package/dist/content/components/ui/Banner/index.tsx +29 -0
- package/dist/content/components/{canvas → ui}/Banner/style-utils.ts +1 -2
- package/dist/content/components/ui/Carousel/index.ts +2 -2
- package/dist/content/components/ui/ComponentEmptyPlaceholder/component-empty-placeholder.tsx +13 -0
- package/dist/content/components/ui/ComponentEmptyPlaceholder/index.ts +6 -0
- package/dist/content/components/ui/Flex/flex.tsx +2 -0
- package/dist/content/components/ui/Flex/index.ts +2 -0
- package/dist/content/components/ui/FlexItem/index.ts +1 -1
- package/dist/content/components/ui/Footer/index.ts +4 -3
- package/dist/content/components/ui/Grid/grid.tsx +2 -0
- package/dist/content/components/ui/Grid/index.ts +3 -0
- package/dist/content/components/ui/GridItem/grid-item.tsx +10 -1
- package/dist/content/components/ui/GridItem/index.ts +3 -0
- package/dist/content/components/ui/IconLabel/icon-label.tsx +2 -0
- package/dist/content/components/ui/IconLabel/index.ts +1 -0
- package/dist/content/components/ui/InlineSVG/index.ts +3 -1
- package/dist/content/components/ui/InlineSVG/inline-svg.tsx +14 -3
- package/dist/content/components/ui/InlineSVG/utils.ts +66 -11
- package/dist/content/components/ui/Rating/index.tsx +1 -1
- package/dist/content/components/ui/Rating/rating.tsx +1 -1
- package/dist/content/types/cskTypes.ts +32 -9
- package/dist/content/utils/assets.ts +3 -18
- package/dist/content/utils/createComponentResolver.ts +7 -6
- package/dist/content/utils/createEmptyPlaceholderResolver.tsx +4 -8
- package/dist/content/utils/getSlotComponents.ts +15 -0
- package/dist/content/utils/routing.ts +60 -15
- package/dist/content/utils/useCookiesConsent.ts +17 -0
- package/dist/content/utils/withFlattenParameters.tsx +17 -0
- package/dist/content/utils/withSlotsDataValue.tsx +34 -0
- package/dist/cookie-consent-5QJUCW2K.mjs +1 -0
- package/dist/countdown-FRQZMVKW.mjs +1 -0
- package/dist/image-gallery-HWCMTJL3.mjs +1 -0
- package/dist/{index-D5cLtaIv.d.mts → index-CSSWgmI5.d.mts} +54 -28
- package/dist/index-CrBZatTs.d.mts +18 -0
- package/dist/index.mjs +3 -3
- package/dist/mobile-KBYNJEBM.mjs +1 -0
- package/dist/modal-4TVVGHWS.mjs +1 -0
- package/dist/modal-E5RMA4EO.mjs +1 -0
- package/dist/navigation-flyout-client-WUN4A34X.mjs +1 -0
- package/dist/navigation-group-client-Y72BOPIH.mjs +1 -0
- package/dist/parameters-B8w5Q6Pp.d.mts +29 -0
- package/dist/tabs-VMFTATOP.mjs +1 -0
- package/dist/theme-switcher-QTX46Z7E.mjs +1 -0
- package/dist/theme-switcher-RGY4D3KL.mjs +1 -0
- package/dist/types/cskTypes.d.mts +27 -9
- package/dist/utils/assets.d.mts +8 -17
- package/dist/utils/assets.mjs +1 -1
- package/dist/utils/createComponentResolver.d.mts +3 -9
- package/dist/utils/createComponentResolver.mjs +1 -1
- package/dist/utils/createEmptyPlaceholderResolver.d.mts +4 -2
- package/dist/utils/createEmptyPlaceholderResolver.mjs +1 -1
- package/dist/utils/getSlotComponents.d.mts +11 -0
- package/dist/utils/getSlotComponents.mjs +1 -0
- package/dist/utils/routing.d.mts +20 -7
- package/dist/utils/routing.mjs +1 -1
- package/dist/utils/sitemap.mjs +1 -1
- package/dist/utils/styling.d.mts +3 -0
- package/dist/utils/styling.mjs +1 -1
- package/dist/utils/withFlattenParameters.d.mts +10 -0
- package/dist/utils/withFlattenParameters.mjs +1 -0
- package/dist/utils/withSlotsDataValue.d.mts +12 -0
- package/dist/utils/withSlotsDataValue.mjs +1 -0
- package/dist/video-VG6ZQCKN.mjs +1 -0
- package/package.json +43 -14
- package/dist/ThemeSwitcher-6Q7LCO4Q.mjs +0 -1
- package/dist/accordion-item-QAVKQEB2.mjs +0 -1
- package/dist/accordion-item-Y4PSNOH4.mjs +0 -1
- package/dist/banner-EYII7V7X.mjs +0 -1
- package/dist/carousel-RZ2DV6QX.mjs +0 -1
- package/dist/carousel-YELQRJVB.mjs +0 -1
- package/dist/chunk-2UV7TQNF.mjs +0 -1
- package/dist/chunk-2YTACEBA.mjs +0 -1
- package/dist/chunk-56OQGKRM.mjs +0 -1
- package/dist/chunk-ABORGLS6.mjs +0 -2
- package/dist/chunk-B2O55EVA.mjs +0 -1
- package/dist/chunk-EOV2LPGC.mjs +0 -1
- package/dist/chunk-EUVKAE6M.mjs +0 -1
- package/dist/chunk-FIN5US3Q.mjs +0 -1
- package/dist/chunk-LZOK42EM.mjs +0 -1
- package/dist/chunk-MSXDLSXH.mjs +0 -1
- package/dist/chunk-RX4IAAQQ.mjs +0 -1
- package/dist/chunk-RYEXR67P.mjs +0 -1
- package/dist/chunk-TCQTXNKT.mjs +0 -1
- package/dist/chunk-TFA6HYP4.mjs +0 -7
- package/dist/chunk-VW2XC3SE.mjs +0 -1
- package/dist/chunk-YEKQJ4YC.mjs +0 -1
- package/dist/content/components/canvas/Banner/types.ts +0 -21
- package/dist/countdown-LYDXJLEE.mjs +0 -1
- package/dist/image-gallery-AMU6FS7N.mjs +0 -1
- package/dist/mobile-JGZBHQC2.mjs +0 -1
- package/dist/modal-43IHAVWB.mjs +0 -1
- package/dist/modal-5FNTFSTN.mjs +0 -1
- package/dist/navigation-flyout-EPIOXRWJ.mjs +0 -1
- package/dist/navigation-group-OCZ35QI2.mjs +0 -1
- package/dist/tabs-J23TEEQ7.mjs +0 -1
- package/dist/theme-switcher-76F2V343.mjs +0 -1
- package/dist/theme-switcher-WO5JIV2W.mjs +0 -1
- package/dist/video-RC2QHJS2.mjs +0 -1
- /package/dist/content/components/{canvas → ui}/Banner/close-button.tsx +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FC, useMemo } from 'react';
|
|
2
|
-
import { UniformText } from '@uniformdev/
|
|
2
|
+
import { ComponentParameter, UniformText } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import BaseButton, { ButtonProps as BaseButtonProps } from '@/components/ui/Button';
|
|
4
4
|
import BaseImage from '@/components/ui/Image';
|
|
5
|
-
import {
|
|
5
|
+
import { ReplaceFieldsWithAssets } from '@/types/cskTypes';
|
|
6
6
|
import { formatUniformLink } from '@/utils/routing';
|
|
7
|
-
import {
|
|
7
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
8
|
+
import { ButtonParameters, ButtonProps } from '.';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const Button: FC<ButtonProps & ReplaceFieldsWithAssets<ButtonParameters, 'icon'>> = ({
|
|
10
11
|
component,
|
|
11
12
|
context,
|
|
12
13
|
link,
|
|
@@ -25,13 +26,13 @@ export const Button: FC<ButtonProps> = ({
|
|
|
25
26
|
className,
|
|
26
27
|
onClick,
|
|
27
28
|
text,
|
|
29
|
+
variant,
|
|
30
|
+
parameters,
|
|
28
31
|
}) => {
|
|
29
32
|
const href = formatUniformLink(link);
|
|
30
33
|
|
|
31
|
-
const isEditorPreviewMode = context.previewMode === 'editor' && context?.isContextualEditing;
|
|
32
|
-
|
|
33
34
|
const iconParameters = useMemo(() => {
|
|
34
|
-
const [resolvedImage] =
|
|
35
|
+
const [resolvedImage] = icon || [];
|
|
35
36
|
const { url, title = '' } = resolvedImage || {};
|
|
36
37
|
if (!url) return undefined;
|
|
37
38
|
|
|
@@ -62,18 +63,18 @@ export const Button: FC<ButtonProps> = ({
|
|
|
62
63
|
|
|
63
64
|
const hasContent = !!text || !!iconParameters;
|
|
64
65
|
|
|
65
|
-
if (!hasContent && !
|
|
66
|
+
if (!hasContent && !context.isContextualEditing) return null;
|
|
66
67
|
|
|
67
68
|
return (
|
|
68
69
|
<BaseButton
|
|
69
|
-
variant={
|
|
70
|
+
variant={variant as BaseButtonProps['variant']}
|
|
70
71
|
href={href}
|
|
71
72
|
border={border}
|
|
72
73
|
size={size}
|
|
73
74
|
onClick={onClick}
|
|
74
75
|
className={className}
|
|
75
76
|
textSize={textSize}
|
|
76
|
-
isActive={context.
|
|
77
|
+
isActive={context.pageState.routePath === href}
|
|
77
78
|
textColor={textColor}
|
|
78
79
|
textFont={textFont}
|
|
79
80
|
textWeight={textWeight}
|
|
@@ -81,10 +82,17 @@ export const Button: FC<ButtonProps> = ({
|
|
|
81
82
|
buttonColor={buttonColor}
|
|
82
83
|
hoverButtonColor={hoverButtonColor}
|
|
83
84
|
hoverTextColor={hoverTextColor}
|
|
85
|
+
// eslint-disable-next-line react-hooks/static-components
|
|
84
86
|
icon={<Icon />}
|
|
85
87
|
iconPosition={iconPosition}
|
|
86
88
|
>
|
|
87
|
-
<UniformText
|
|
89
|
+
<UniformText
|
|
90
|
+
placeholder="Button text goes here"
|
|
91
|
+
parameter={parameters.text as ComponentParameter<string>}
|
|
92
|
+
component={component}
|
|
93
|
+
/>
|
|
88
94
|
</BaseButton>
|
|
89
95
|
);
|
|
90
96
|
};
|
|
97
|
+
|
|
98
|
+
export default withFlattenParameters(Button);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { AssetParamValue } from '@uniformdev/assets';
|
|
2
2
|
import { LinkParamValue } from '@uniformdev/canvas';
|
|
3
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
4
3
|
import { ButtonProps as BaseButtonProps } from '@/components/ui/Button';
|
|
5
|
-
import { ViewPort } from '@/types/cskTypes';
|
|
6
|
-
import { Button } from './button';
|
|
4
|
+
import { ComponentProps, ViewPort } from '@/types/cskTypes';
|
|
7
5
|
|
|
8
6
|
export type ButtonParameters = {
|
|
9
7
|
text?: string;
|
|
@@ -28,6 +26,6 @@ export type ButtonAdditionalProps = {
|
|
|
28
26
|
onClick?: () => void;
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
export type ButtonProps = ComponentProps<ButtonParameters & ButtonAdditionalProps
|
|
29
|
+
export type ButtonProps = ComponentProps<ButtonParameters> & ButtonAdditionalProps;
|
|
32
30
|
|
|
33
|
-
export default
|
|
31
|
+
export { default } from './button';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { UniformSlot } from '@uniformdev/
|
|
2
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import Container from '@/components/ui/Container';
|
|
4
4
|
import { cn } from '@/utils/styling';
|
|
5
|
-
import {
|
|
5
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
6
|
+
import { CardParameters, CardProps, CardVariants } from '.';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
component,
|
|
9
|
-
context,
|
|
8
|
+
const Card: FC<CardProps & CardParameters> = ({
|
|
10
9
|
slots,
|
|
11
10
|
backgroundColor,
|
|
12
11
|
spacing,
|
|
@@ -15,8 +14,9 @@ export const Card: FC<CardProps> = ({
|
|
|
15
14
|
height,
|
|
16
15
|
className,
|
|
17
16
|
contentClassName,
|
|
17
|
+
variant,
|
|
18
18
|
}) => {
|
|
19
|
-
const isBackgroundImageVariant =
|
|
19
|
+
const isBackgroundImageVariant = variant === CardVariants.BackgroundImage;
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<Container
|
|
@@ -28,13 +28,13 @@ export const Card: FC<CardProps> = ({
|
|
|
28
28
|
'inset-0 size-full absolute': isBackgroundImageVariant,
|
|
29
29
|
})}
|
|
30
30
|
>
|
|
31
|
-
<UniformSlot
|
|
31
|
+
<UniformSlot slot={slots.cardMedia} />
|
|
32
32
|
</div>
|
|
33
33
|
<div className={cn('relative flex flex-col gap-y-2', contentClassName)}>
|
|
34
|
-
<UniformSlot
|
|
34
|
+
<UniformSlot slot={slots.cardContent} />
|
|
35
35
|
</div>
|
|
36
36
|
</Container>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
export default Card;
|
|
40
|
+
export default withFlattenParameters(Card);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
2
1
|
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
2
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
3
3
|
|
|
4
4
|
export type CardAdditionalProps = {
|
|
5
5
|
className?: string;
|
|
@@ -17,7 +17,7 @@ export enum CardSlots {
|
|
|
17
17
|
CardContent = 'cardContent',
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type CardProps = ComponentProps<CardParameters & CardAdditionalProps
|
|
20
|
+
export type CardProps = ComponentProps<CardParameters, CardSlots> & CardAdditionalProps;
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { default } from './card';
|
|
23
23
|
export { CardEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { FC } from 'react';
|
|
4
|
-
import { UniformSlot } from '@uniformdev/
|
|
4
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
5
5
|
import BaseCarousel from '@/components/ui/Carousel';
|
|
6
|
-
import {
|
|
6
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
7
|
+
import { CarouselParameters, CarouselProps } from '.';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const Carousel: FC<CarouselProps & CarouselParameters> = ({
|
|
9
10
|
slots,
|
|
10
|
-
component,
|
|
11
|
-
context,
|
|
12
11
|
backgroundColor,
|
|
13
12
|
spacing,
|
|
14
13
|
border,
|
|
@@ -16,14 +15,15 @@ export const Carousel: FC<CarouselProps> = ({
|
|
|
16
15
|
height,
|
|
17
16
|
itemsPerPage,
|
|
18
17
|
gapX,
|
|
18
|
+
variant,
|
|
19
19
|
}) => (
|
|
20
20
|
<BaseCarousel
|
|
21
21
|
{...{ backgroundColor, spacing, border, fluidContent, height, itemsPerPage, gapX }}
|
|
22
22
|
countOfItems={slots.carouselItems?.items.length ?? 0}
|
|
23
|
-
variant={
|
|
23
|
+
variant={variant}
|
|
24
24
|
>
|
|
25
25
|
{({ className, style }) => (
|
|
26
|
-
<UniformSlot
|
|
26
|
+
<UniformSlot slot={slots.carouselItems}>
|
|
27
27
|
{({ child, key }) => (
|
|
28
28
|
<div key={key} className={className} style={style}>
|
|
29
29
|
{child}
|
|
@@ -33,3 +33,5 @@ export const Carousel: FC<CarouselProps> = ({
|
|
|
33
33
|
)}
|
|
34
34
|
</BaseCarousel>
|
|
35
35
|
);
|
|
36
|
+
|
|
37
|
+
export default withFlattenParameters(Carousel);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
3
2
|
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
3
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
4
4
|
|
|
5
5
|
export type CarouselParameters = ContainerParameters & {
|
|
6
|
-
itemsPerPage
|
|
7
|
-
gapX
|
|
6
|
+
itemsPerPage?: string;
|
|
7
|
+
gapX?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export enum CarouselSlots {
|
|
@@ -13,5 +13,5 @@ export enum CarouselSlots {
|
|
|
13
13
|
|
|
14
14
|
export type CarouselProps = ComponentProps<CarouselParameters, CarouselSlots>;
|
|
15
15
|
|
|
16
|
-
export default dynamic(() => import('./carousel').then(mod => mod.
|
|
16
|
+
export default dynamic(() => import('./carousel').then(mod => mod.default));
|
|
17
17
|
export { CarouselEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { UniformSlot } from '@uniformdev/
|
|
2
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import BaseContainer from '@/components/ui/Container';
|
|
4
|
-
import {
|
|
4
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
5
|
+
import { ContainerParameters, ContainerProps } from '.';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
const Container: FC<ContainerProps & ContainerParameters> = ({
|
|
7
8
|
displayName,
|
|
8
9
|
anchor: id,
|
|
9
10
|
slots,
|
|
10
|
-
component,
|
|
11
|
-
context,
|
|
12
11
|
backgroundColor,
|
|
13
12
|
spacing,
|
|
14
13
|
border,
|
|
@@ -28,6 +27,8 @@ export const Container: FC<ContainerProps> = ({
|
|
|
28
27
|
className,
|
|
29
28
|
}}
|
|
30
29
|
>
|
|
31
|
-
<UniformSlot
|
|
30
|
+
<UniformSlot slot={slots.containerContent} />
|
|
32
31
|
</BaseContainer>
|
|
33
32
|
);
|
|
33
|
+
|
|
34
|
+
export default withFlattenParameters(Container);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from '
|
|
1
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
2
2
|
import { ContainerParameters } from './parameters';
|
|
3
3
|
|
|
4
4
|
export type ContainerAdditionalProps = {
|
|
@@ -9,7 +9,7 @@ export enum ContainerSlots {
|
|
|
9
9
|
ContainerContent = 'containerContent',
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export type ContainerProps = ComponentProps<ContainerParameters & ContainerAdditionalProps
|
|
12
|
+
export type ContainerProps = ComponentProps<ContainerParameters, ContainerSlots> & ContainerAdditionalProps;
|
|
13
13
|
|
|
14
14
|
export { type ContainerParameters } from './parameters';
|
|
15
|
-
export {
|
|
15
|
+
export { default } from './container';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FC, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
|
+
import { ComponentParameter, UniformSlot, UniformText } from '@uniformdev/next-app-router/component';
|
|
6
|
+
import BaseBanner, { BannerVariants } from '@/components/ui/Banner';
|
|
7
|
+
import BaseButton from '@/components/ui/Button';
|
|
8
|
+
import useCookiesConsent from '@/utils/useCookiesConsent';
|
|
9
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
10
|
+
import { CookieConsentProps, CookieConsentParameters } from '.';
|
|
11
|
+
|
|
12
|
+
const CLIENT_COOKIE_NAME = 'hasAcceptedCookies';
|
|
13
|
+
|
|
14
|
+
const CookieConsent: FC<CookieConsentProps & CookieConsentParameters> = ({
|
|
15
|
+
backgroundColor,
|
|
16
|
+
spacing,
|
|
17
|
+
border,
|
|
18
|
+
fluidContent,
|
|
19
|
+
allowTextColor,
|
|
20
|
+
allowButtonColor,
|
|
21
|
+
allowButtonHoverColor,
|
|
22
|
+
declineTextColor,
|
|
23
|
+
declineButtonColor,
|
|
24
|
+
declineButtonHoverColor,
|
|
25
|
+
slots,
|
|
26
|
+
variant,
|
|
27
|
+
parameters,
|
|
28
|
+
component,
|
|
29
|
+
context,
|
|
30
|
+
}) => {
|
|
31
|
+
const [showCookieConsent, setShowCookieConsent] = useState(false);
|
|
32
|
+
const { consent, updateConsent } = useCookiesConsent();
|
|
33
|
+
const { defaultConsent } = context?.pageState || {};
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// get user has accepted cookies from cookie
|
|
37
|
+
const cookieValue = Cookies.get(CLIENT_COOKIE_NAME);
|
|
38
|
+
const userHasAcceptedCookies = cookieValue === undefined ? undefined : cookieValue === 'true';
|
|
39
|
+
|
|
40
|
+
if (userHasAcceptedCookies === undefined) {
|
|
41
|
+
// if user has not accepted cookies and default consent is false, show cookie consent
|
|
42
|
+
if (!defaultConsent) {
|
|
43
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
44
|
+
setShowCookieConsent(true);
|
|
45
|
+
|
|
46
|
+
// if consent is true, but user has not accepted cookies, update consent to false
|
|
47
|
+
if (consent) {
|
|
48
|
+
updateConsent(false);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// if user has accepted cookies and consent is not the same, update consent
|
|
55
|
+
if (consent !== userHasAcceptedCookies) {
|
|
56
|
+
updateConsent(userHasAcceptedCookies);
|
|
57
|
+
}
|
|
58
|
+
}, [defaultConsent, consent, updateConsent, setShowCookieConsent]);
|
|
59
|
+
|
|
60
|
+
const handleAllowCookiesButtonClick = useCallback(() => {
|
|
61
|
+
updateConsent(true);
|
|
62
|
+
Cookies.set(CLIENT_COOKIE_NAME, 'true');
|
|
63
|
+
setShowCookieConsent(false);
|
|
64
|
+
}, [updateConsent]);
|
|
65
|
+
|
|
66
|
+
const handleDeclineCookiesButtonClick = useCallback(() => {
|
|
67
|
+
updateConsent(false);
|
|
68
|
+
Cookies.set(CLIENT_COOKIE_NAME, 'false');
|
|
69
|
+
setShowCookieConsent(false);
|
|
70
|
+
}, [updateConsent]);
|
|
71
|
+
|
|
72
|
+
if (!showCookieConsent) return null;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<BaseBanner
|
|
76
|
+
{...{
|
|
77
|
+
backgroundColor,
|
|
78
|
+
spacing,
|
|
79
|
+
border,
|
|
80
|
+
fluidContent,
|
|
81
|
+
floating: true,
|
|
82
|
+
variant: variant as BannerVariants,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<div className="flex flex-col gap-x-6 md:flex-row p-5 xs:p-10 items-center justify-between w-full">
|
|
86
|
+
<UniformSlot slot={slots.cookieConsentContent} />
|
|
87
|
+
<div className="flex justify-between gap-2 flex-col sm:flex-row md:flex-col lg:flex-row shrink-0 md:justify-start w-full md:w-auto md:space-x-0 md:space-y-2 lg:space-y-0 lg:space-x-3 mt-4 md:mt-0">
|
|
88
|
+
<BaseButton
|
|
89
|
+
className="w-full cursor-pointer"
|
|
90
|
+
size="button-medium"
|
|
91
|
+
textSize="sm"
|
|
92
|
+
textWeight="normal"
|
|
93
|
+
buttonColor={allowButtonColor}
|
|
94
|
+
textColor={allowTextColor}
|
|
95
|
+
hoverButtonColor={allowButtonHoverColor}
|
|
96
|
+
onClick={handleAllowCookiesButtonClick}
|
|
97
|
+
>
|
|
98
|
+
<UniformText
|
|
99
|
+
placeholder="allowButtonText"
|
|
100
|
+
parameter={parameters.allowButtonText as ComponentParameter<string>}
|
|
101
|
+
component={component}
|
|
102
|
+
/>
|
|
103
|
+
</BaseButton>
|
|
104
|
+
<BaseButton
|
|
105
|
+
className="w-full cursor-pointer"
|
|
106
|
+
size="button-medium"
|
|
107
|
+
textSize="sm"
|
|
108
|
+
textWeight="normal"
|
|
109
|
+
buttonColor={declineButtonColor}
|
|
110
|
+
textColor={declineTextColor}
|
|
111
|
+
hoverButtonColor={declineButtonHoverColor}
|
|
112
|
+
onClick={handleDeclineCookiesButtonClick}
|
|
113
|
+
>
|
|
114
|
+
<UniformText
|
|
115
|
+
placeholder="declineButtonText"
|
|
116
|
+
parameter={parameters.declineButtonText as ComponentParameter<string>}
|
|
117
|
+
component={component}
|
|
118
|
+
/>
|
|
119
|
+
</BaseButton>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</BaseBanner>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default withFlattenParameters(CookieConsent);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResolveEmptyPlaceholderOptions } from '@/types/cskTypes';
|
|
2
|
+
import { DEFAULT_EMPTY_PLACEHOLDER } from '@/utils/createEmptyPlaceholderResolver';
|
|
3
|
+
import { CookieConsentSlots } from '.';
|
|
4
|
+
|
|
5
|
+
export const CookieConsentEmptyPlaceholder = (props: ResolveEmptyPlaceholderOptions) => {
|
|
6
|
+
switch (props.slotName) {
|
|
7
|
+
case CookieConsentSlots.CookieConsentContent:
|
|
8
|
+
return { component: () => <div className="h-20 w-full" /> };
|
|
9
|
+
default:
|
|
10
|
+
return DEFAULT_EMPTY_PLACEHOLDER;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import dynamic from 'next/dynamic';
|
|
2
|
+
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
3
|
+
import { ContentAlignment } from '@/components/ui/Banner';
|
|
4
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
5
|
+
|
|
6
|
+
export enum CookieConsentSlots {
|
|
7
|
+
CookieConsentContent = 'cookieConsentContent',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type CookieConsentParameters = ContainerParameters & {
|
|
11
|
+
allowButtonText?: string;
|
|
12
|
+
allowTextColor?: string;
|
|
13
|
+
allowButtonColor?: string;
|
|
14
|
+
allowButtonHoverColor?: string;
|
|
15
|
+
declineButtonText?: string;
|
|
16
|
+
declineTextColor?: string;
|
|
17
|
+
declineButtonColor?: string;
|
|
18
|
+
declineButtonHoverColor?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CookieConsentProps = ComponentProps<CookieConsentParameters, CookieConsentSlots>;
|
|
22
|
+
|
|
23
|
+
export { ContentAlignment };
|
|
24
|
+
|
|
25
|
+
export default dynamic(() => import('./cookie-consent').then(mod => mod.default));
|
|
26
|
+
export { CookieConsentEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { FC, useState, useEffect, useMemo } from 'react';
|
|
4
|
-
import { UniformSlot } from '@uniformdev/
|
|
5
|
-
import {
|
|
4
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
5
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
6
|
+
import { CountdownParameters, CountdownProps, CountdownVariants } from '.';
|
|
6
7
|
import { CountdownUnit } from './constants';
|
|
7
8
|
import { getTextClass, getUnitClass } from './style-utils';
|
|
8
9
|
import { formatTime, renderNumberList } from './utils';
|
|
9
10
|
|
|
10
11
|
const UNITS_TO_SHOW = [CountdownUnit.Days, CountdownUnit.Hours, CountdownUnit.Minutes, CountdownUnit.Seconds];
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
const Countdown: FC<CountdownProps & CountdownParameters> = ({
|
|
13
14
|
targetDate,
|
|
14
15
|
backgroundColor,
|
|
15
16
|
textColor,
|
|
16
17
|
border,
|
|
17
18
|
size,
|
|
18
|
-
component,
|
|
19
|
-
context,
|
|
20
19
|
slots,
|
|
20
|
+
variant,
|
|
21
21
|
}) => {
|
|
22
22
|
const [{ timeDifference, ...time }, setTime] = useState(formatTime(targetDate));
|
|
23
23
|
|
|
@@ -55,7 +55,7 @@ export const Countdown: FC<CountdownProps> = ({
|
|
|
55
55
|
<div
|
|
56
56
|
key={unit}
|
|
57
57
|
className={getUnitClass({
|
|
58
|
-
variant:
|
|
58
|
+
variant: variant as CountdownVariants,
|
|
59
59
|
backgroundColor,
|
|
60
60
|
border,
|
|
61
61
|
size,
|
|
@@ -77,8 +77,10 @@ export const Countdown: FC<CountdownProps> = ({
|
|
|
77
77
|
})}
|
|
78
78
|
</div>
|
|
79
79
|
) : (
|
|
80
|
-
<UniformSlot
|
|
80
|
+
<UniformSlot slot={slots.countdownComplete} />
|
|
81
81
|
)}
|
|
82
82
|
</div>
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
|
+
|
|
86
|
+
export default withFlattenParameters(Countdown);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
3
2
|
import { TextProps as BaseTextProps } from '@/components/ui/Text';
|
|
4
|
-
import { ViewPort } from '@/types/cskTypes';
|
|
3
|
+
import { ComponentProps, ViewPort } from '@/types/cskTypes';
|
|
5
4
|
|
|
6
5
|
type UniformDate = {
|
|
7
6
|
datetime: string;
|
|
@@ -25,5 +24,5 @@ export enum CountdownVariants {
|
|
|
25
24
|
|
|
26
25
|
export type CountdownProps = ComponentProps<CountdownParameters, CountdownSlots>;
|
|
27
26
|
|
|
28
|
-
export default dynamic(() => import('./countdown').then(mod => mod.
|
|
27
|
+
export default dynamic(() => import('./countdown').then(mod => mod.default));
|
|
29
28
|
export { CountdownEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,62 +1,54 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { imageFrom } from '@uniformdev/assets';
|
|
3
|
-
|
|
4
|
-
import {
|
|
3
|
+
|
|
4
|
+
import { ComponentContext, ComponentParameter, UniformText } from '@uniformdev/next-app-router/component';
|
|
5
5
|
import { TextParameters } from '@/components/canvas/Text/parameters';
|
|
6
6
|
import BaseButton, { ButtonVariant } from '@/components/ui/Button';
|
|
7
7
|
import BaseImage from '@/components/ui/Image';
|
|
8
8
|
import MediaPlaceholder from '@/components/ui/MediaPlaceholder';
|
|
9
9
|
import BaseText from '@/components/ui/Text';
|
|
10
|
-
import {
|
|
10
|
+
import { ReplaceFieldsWithAssets } from '@/types/cskTypes';
|
|
11
11
|
import { formatUniformLink } from '@/utils/routing';
|
|
12
12
|
import { BaseButtonParameters, BaseImageParameters } from '.';
|
|
13
13
|
|
|
14
14
|
type ComponentProps = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
isEditorPreviewMode?: boolean;
|
|
16
|
+
component: Pick<ComponentContext, '_id'>;
|
|
17
|
+
parameter?: ComponentParameter<string | undefined>;
|
|
18
|
+
variant?: string;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
export const BaseHeroText: FC<TextParameters & ComponentProps
|
|
21
|
+
export const BaseHeroText: FC<TextParameters & Omit<ComponentProps, 'variant'>> = ({
|
|
21
22
|
component,
|
|
22
|
-
|
|
23
|
-
parameterId,
|
|
23
|
+
parameter,
|
|
24
24
|
text,
|
|
25
|
+
isEditorPreviewMode,
|
|
25
26
|
...props
|
|
26
27
|
}) => {
|
|
27
|
-
const isEditorPreviewMode = context.previewMode === 'editor' && context.isContextualEditing;
|
|
28
|
-
|
|
29
28
|
if (!text && !isEditorPreviewMode) return null;
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<BaseText {...props}>
|
|
33
32
|
<UniformText
|
|
34
33
|
placeholder="Text goes here"
|
|
35
|
-
|
|
34
|
+
parameter={parameter as ComponentParameter<string>}
|
|
36
35
|
as={props.tag || undefined}
|
|
37
36
|
component={component}
|
|
38
|
-
context={context}
|
|
39
37
|
/>
|
|
40
38
|
</BaseText>
|
|
41
39
|
);
|
|
42
40
|
};
|
|
43
41
|
|
|
44
|
-
export const BaseHeroButton: FC<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
parameterId,
|
|
48
|
-
text,
|
|
49
|
-
...props
|
|
50
|
-
}) => {
|
|
42
|
+
export const BaseHeroButton: FC<
|
|
43
|
+
ReplaceFieldsWithAssets<BaseButtonParameters, 'icon'> & { variant?: ButtonVariant } & Omit<ComponentProps, 'variant'>
|
|
44
|
+
> = ({ component, parameter, isEditorPreviewMode, text, ...props }) => {
|
|
51
45
|
const { link, icon } = props;
|
|
52
46
|
const href = formatUniformLink(link);
|
|
53
47
|
|
|
54
|
-
const isEditorPreviewMode = context.previewMode === 'editor' && context.isContextualEditing;
|
|
55
|
-
|
|
56
48
|
if (!text && !href && !isEditorPreviewMode) return null;
|
|
57
49
|
|
|
58
50
|
const Icon = () => {
|
|
59
|
-
const [resolvedImage] =
|
|
51
|
+
const [resolvedImage] = icon || [];
|
|
60
52
|
const { url, title = '' } = resolvedImage || {};
|
|
61
53
|
return url ? (
|
|
62
54
|
<BaseImage
|
|
@@ -72,20 +64,22 @@ export const BaseHeroButton: FC<BaseButtonParameters & { variant?: ButtonVariant
|
|
|
72
64
|
) : undefined;
|
|
73
65
|
};
|
|
74
66
|
return (
|
|
67
|
+
// eslint-disable-next-line react-hooks/static-components
|
|
75
68
|
<BaseButton {...props} href={href} icon={<Icon />}>
|
|
76
69
|
<UniformText
|
|
77
70
|
placeholder="Button text goes here"
|
|
78
|
-
|
|
71
|
+
parameter={parameter as ComponentParameter<string>}
|
|
79
72
|
component={component}
|
|
80
|
-
context={context}
|
|
81
73
|
/>
|
|
82
74
|
</BaseButton>
|
|
83
75
|
);
|
|
84
76
|
};
|
|
85
77
|
|
|
86
|
-
export const BaseHeroImage: FC<
|
|
78
|
+
export const BaseHeroImage: FC<
|
|
79
|
+
ReplaceFieldsWithAssets<BaseImageParameters, 'image'> & Omit<ComponentProps, 'parameter'>
|
|
80
|
+
> = ({
|
|
87
81
|
component,
|
|
88
|
-
|
|
82
|
+
isEditorPreviewMode,
|
|
89
83
|
image,
|
|
90
84
|
objectFit,
|
|
91
85
|
width,
|
|
@@ -97,14 +91,14 @@ export const BaseHeroImage: FC<BaseImageParameters & Omit<ComponentProps, 'param
|
|
|
97
91
|
priority,
|
|
98
92
|
unoptimized,
|
|
99
93
|
fill,
|
|
94
|
+
variant,
|
|
100
95
|
}) => {
|
|
101
|
-
const [resolvedImage] =
|
|
96
|
+
const [resolvedImage] = image || [];
|
|
102
97
|
|
|
103
98
|
if (!resolvedImage) {
|
|
104
|
-
const isEditorPreviewMode = context.previewMode === 'editor' && context.isContextualEditing;
|
|
105
99
|
const isPlaceholder = component?._id?.includes('placeholder_');
|
|
106
100
|
|
|
107
|
-
if (!isEditorPreviewMode || isPlaceholder || !
|
|
101
|
+
if (!isEditorPreviewMode || isPlaceholder || !variant) {
|
|
108
102
|
return null;
|
|
109
103
|
}
|
|
110
104
|
|
|
@@ -123,7 +117,7 @@ export const BaseHeroImage: FC<BaseImageParameters & Omit<ComponentProps, 'param
|
|
|
123
117
|
if (!fill && (!imageWidth || !imageHeight)) {
|
|
124
118
|
console.warn(
|
|
125
119
|
'No dimensions provided for the Next.js Image component. Falling back to a standard <img> tag for rendering.'
|
|
126
|
-
);
|
|
120
|
+
); // eslint-disable-next-line @next/next/no-img-element
|
|
127
121
|
return <img src={resolvedImage.url} alt={title} />;
|
|
128
122
|
}
|
|
129
123
|
|
|
@@ -150,7 +144,10 @@ export const BaseHeroImage: FC<BaseImageParameters & Omit<ComponentProps, 'param
|
|
|
150
144
|
unoptimized={unoptimized}
|
|
151
145
|
priority={priority}
|
|
152
146
|
sizes="100%"
|
|
153
|
-
style={{
|
|
147
|
+
style={{
|
|
148
|
+
objectFit,
|
|
149
|
+
objectPosition: focalPoint && !width && !height ? `${focalPoint.x * 100}% ${focalPoint.y * 100}%` : undefined,
|
|
150
|
+
}}
|
|
154
151
|
overlayColor={overlayColor}
|
|
155
152
|
contrastBaseColor={contrastBaseColor}
|
|
156
153
|
overlayOpacity={overlayOpacity}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import Container from '@/components/ui/Container';
|
|
3
3
|
import { cn } from '@/utils/styling';
|
|
4
4
|
import { DemoHeroVariants, FlexibleHeroParameters } from '.';
|
|
@@ -10,9 +10,9 @@ type ColumnsVariantProps = {
|
|
|
10
10
|
fluidContent: FlexibleHeroParameters['fluidContent'];
|
|
11
11
|
height: FlexibleHeroParameters['height'];
|
|
12
12
|
variant?: DemoHeroVariants;
|
|
13
|
-
demoHeroMedia:
|
|
14
|
-
demoHeroContent:
|
|
15
|
-
demoHeroCTA:
|
|
13
|
+
demoHeroMedia: ReactNode;
|
|
14
|
+
demoHeroContent: ReactNode;
|
|
15
|
+
demoHeroCTA: ReactNode;
|
|
16
16
|
textAlignmentClass: string;
|
|
17
17
|
buttonAlignmentClass: string;
|
|
18
18
|
};
|