diff --git a/app/components/Icon.tsx b/app/components/Icon.tsx index 96a4bf1..a783636 100644 --- a/app/components/Icon.tsx +++ b/app/components/Icon.tsx @@ -320,3 +320,12 @@ export function IconMapBlank(props: IconProps) { ); } + +export function IconImageBlank(props: IconProps) { + return ( + + + + + ); +} diff --git a/app/sections/header-image/button-image-item.tsx b/app/sections/header-image/button-image-item.tsx new file mode 100644 index 0000000..59061fb --- /dev/null +++ b/app/sections/header-image/button-image-item.tsx @@ -0,0 +1,68 @@ +import type { + HydrogenComponentProps, + HydrogenComponentSchema, +} from '@weaverse/hydrogen'; +import { forwardRef } from 'react'; +import clsx from 'clsx'; + + +interface ButtonItemProps extends HydrogenComponentProps { + buttonLink: string; + buttonLabel: string; + openInNewTab: boolean; + buttonStyle: string; +} + +let buttonItem = forwardRef((props, ref) => { + let { buttonLink, buttonLabel, openInNewTab, buttonStyle, ...rest } = props; + return ( +
+ {buttonLabel && {buttonLabel}} +
+ ); +}); + +export default buttonItem; + +export let schema: HydrogenComponentSchema = { + type: 'button-image--item', + title: 'Button item', + inspector: [ + { + group: 'Button', + inputs: [ + { + type: 'text', + name: 'buttonLabel', + label: 'Button label', + defaultValue: 'Button', + }, + { + type: 'text', + name: 'buttonLink', + label: 'Button link', + placeholder: 'https://', + }, + { + type: 'switch', + name: 'openInNewTab', + label: 'Open in new tab', + defaultValue: true, + }, + { + type: 'toggle-group', + label: 'Button style', + name: 'buttonStyle', + configs: { + options: [ + { label: '1', value: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white' }, + { label: '2', value: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white' }, + { label: '3', value: 'transition hover:bg-white border-2 border-solid border-white hover:text-black bg-gray-200 text-white' }, + ], + }, + defaultValue: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white', + }, + ], + }, + ], +} diff --git a/app/sections/header-image/description-text-item.tsx b/app/sections/header-image/description-text-item.tsx index db9ef63..6d3b598 100644 --- a/app/sections/header-image/description-text-item.tsx +++ b/app/sections/header-image/description-text-item.tsx @@ -6,17 +6,18 @@ import {forwardRef} from 'react'; interface DescriptionTextItemProps extends HydrogenComponentProps { descriptionText: string; + descriptionSize: string; + descriptionColor: string; } let DescriptionTextItem = forwardRef( (props, ref) => { - let {descriptionText, ...rest} = props; + let {descriptionText, descriptionSize, descriptionColor, ...rest} = props; return (
-

+

{descriptionText}

); }, @@ -32,11 +33,32 @@ export let schema: HydrogenComponentSchema = { group: 'Description text', inputs: [ { - type: 'richtext', + type: 'textarea', label: 'Text', name: 'descriptionText', defaultValue: 'Pair large text with an image to tell a story.', }, + { + type: 'toggle-group', + label: 'Text size', + name: 'descriptionSize', + configs: { + options: [ + { label: 'XS', value: '14px' }, + { label: 'S', value: '16px' }, + { label: 'M', value: '18px' }, + { label: 'L', value: '20px' }, + { label: 'XL', value: '22px' }, + ], + }, + defaultValue: '16px', + }, + { + type: 'color', + name: 'descriptionColor', + label: 'Description color', + defaultValue: '#333333', + }, ], }, ], diff --git a/app/sections/header-image/header-image.tsx b/app/sections/header-image/header-image.tsx index 9f8b68f..aa37517 100644 --- a/app/sections/header-image/header-image.tsx +++ b/app/sections/header-image/header-image.tsx @@ -1,34 +1,30 @@ import type { HydrogenComponentProps, HydrogenComponentSchema, + WeaverseImage, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; import { CSSProperties } from 'react'; import clsx from 'clsx'; import { Image } from '@shopify/hydrogen'; +import { IconImageBlank } from '~/components'; interface HeaderImageProps extends HydrogenComponentProps { - backgroundImage: { - url: string; - altText: string; - width?: number; - height?: number; - }; + backgroundImage: WeaverseImage; contentAlignment: string; enableOverlay: boolean; overlayColor: string; overlayOpacity: number; - sectionHeight: string; - buttonLabel: string; - buttonLink: string; - loading: HTMLImageElement['loading']; + sectionHeightDesktop: number; + sectionHeightMobile: number; } let HeaderImage = forwardRef((props, ref) => { - let { backgroundImage, contentAlignment, enableOverlay, overlayColor, overlayOpacity, sectionHeight, buttonLabel, buttonLink, loading, children, ...rest } = props; + let { backgroundImage, contentAlignment, enableOverlay, overlayColor, overlayOpacity, sectionHeightDesktop, sectionHeightMobile, children, ...rest } = props; let sectionStyle: CSSProperties = { justifyContent: `${contentAlignment}`, - '--section-height': `${sectionHeight}`, + '--section-height-desktop': `${sectionHeightDesktop}px`, + '--section-height-mobile': `${sectionHeightMobile}px`, '--overlay-opacity': `${overlayOpacity}%`, '--overlay-color': `${overlayColor}` } as CSSProperties; @@ -36,18 +32,18 @@ let HeaderImage = forwardRef((props, ref) => { return (
- {backgroundImage && } - {enableOverlay && backgroundImage &&
} + {backgroundImage ? : +
+ +
+ } + {enableOverlay &&
}
-
- {children?.map((child) => { - return child; - })} - {buttonLabel && {buttonLabel}} +
+ {children}
); @@ -108,58 +104,47 @@ export let schema: HydrogenComponentSchema = { condition: `enableOverlay.eq.true` }, { - type: 'text', - name: 'sectionHeight', - label: 'Section height', - defaultValue: '480px', - placeholder: 'Example: 100px', - }, - { - type: 'text', - name: 'buttonLabel', - label: 'Button label', - defaultValue: 'Button', - }, - { - type: 'text', - name: 'buttonLink', - label: 'Button link', - placeholder: 'https://', + type: 'range', + name: 'sectionHeightDesktop', + label: 'Section height desktop', + defaultValue: 450, + configs: { + min: 400, + max: 700, + step: 10, + unit: 'px', + }, }, { - type: 'toggle-group', - name: 'loading', - label: 'Background image loading', - defaultValue: 'eager', + type: 'range', + name: 'sectionHeightMobile', + label: 'Section height mobile', + defaultValue: 350, configs: { - options: [ - { label: 'Eager', value: 'eager', icon: 'Lightning' }, - { - label: 'Lazy', - value: 'lazy', - icon: 'SpinnerGap', - weight: 'light', - }, - ], + min: 300, + max: 600, + step: 10, + unit: 'px', }, - helpText: - 'Learn more about image loading strategies.', }, ], }, ], - childTypes: ['heading--item', 'subheading--item', 'description-text--item'], + childTypes: ['subheading--item', 'heading--item', 'description-text--item', 'button-image--item'], presets: { children: [ { - type: 'heading--item', + type: 'subheading--item', }, { - type: 'subheading--item', + type: 'heading--item', }, { type: 'description-text--item', - } + }, + { + type: 'button-image--item', + }, ], }, }; diff --git a/app/sections/header-image/heading-item.tsx b/app/sections/header-image/heading-item.tsx index 095893f..a9d893d 100644 --- a/app/sections/header-image/heading-item.tsx +++ b/app/sections/header-image/heading-item.tsx @@ -3,22 +3,18 @@ import type { HydrogenComponentSchema, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; -import { CSSProperties } from 'react'; interface HeadingItemProps extends HydrogenComponentProps { heading: string; - headingSize: string; + headingColor: string; } let HeadingItem = forwardRef((props, ref) => { - let {heading, headingSize, ...rest } = props; - let headingStyle: CSSProperties = { - '--font-size-display': `${headingSize}`, - } as CSSProperties; + let { heading, headingColor, ...rest } = props; return ( -
-

{heading}

+
+

{heading}

); }); @@ -40,19 +36,10 @@ export let schema: HydrogenComponentSchema = { placeholder: 'Heading for image section', }, { - type: 'toggle-group', - label: 'Heading size', - name: 'headingSize', - configs: { - options: [ - { label: 'XS', value: '22px' }, - { label: 'S', value: '24px' }, - { label: 'M', value: '26px' }, - { label: 'L', value: '28px' }, - { label: 'XL', value: '30px' }, - ], - }, - defaultValue: '24px', + type: 'color', + name: 'headingColor', + label: 'Heading color', + defaultValue: '#333333', }, ], }, diff --git a/app/sections/header-image/subheading-item.tsx b/app/sections/header-image/subheading-item.tsx index 3916d8a..53ca012 100644 --- a/app/sections/header-image/subheading-item.tsx +++ b/app/sections/header-image/subheading-item.tsx @@ -9,16 +9,18 @@ import { CSSProperties } from 'react'; interface SubHeadingItemProps extends HydrogenComponentProps { subHeading: string; subHeadingSize: string; + subHeadingColor: string; } let SubHeadingItem = forwardRef((props, ref) => { - let { subHeading, subHeadingSize, ...rest } = props; + let { subHeading, subHeadingSize, subHeadingColor, ...rest } = props; let headingStyle: CSSProperties = { - '--font-size-heading': `${subHeadingSize}`, + fontSize: subHeadingSize, + color: subHeadingColor, } as CSSProperties; return ( -
-

{subHeading}

+
+

{subHeading}

); }); @@ -54,6 +56,12 @@ export let schema: HydrogenComponentSchema = { }, defaultValue: '16px', }, + { + type: 'color', + name: 'subHeadingColor', + label: 'Subheading color', + defaultValue: '#333333', + }, ], }, ], diff --git a/app/sections/image-with-text/content-item/button-item.tsx b/app/sections/image-with-text/content-item/button-item.tsx index 1c1a009..e12c6cf 100644 --- a/app/sections/image-with-text/content-item/button-item.tsx +++ b/app/sections/image-with-text/content-item/button-item.tsx @@ -3,18 +3,21 @@ import type { HydrogenComponentSchema, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; +import clsx from 'clsx'; interface ButtonItemProps extends HydrogenComponentProps { buttonLabel: string; buttonLink: string; + openInNewTab: boolean; + buttonStyle: string; } let ImageWTextButtonItem = forwardRef((props, ref) => { - let { buttonLabel, buttonLink, ...rest } = props; + let { buttonLabel, buttonLink, openInNewTab, buttonStyle, ...rest } = props; return ( ); }); @@ -41,6 +44,25 @@ export let schema: HydrogenComponentSchema = { label: 'Button link', placeholder: 'https://' }, + { + type: 'switch', + name: 'openInNewTab', + label: 'Open in new tab', + defaultValue: true, + }, + { + type: 'toggle-group', + label: 'Button style', + name: 'buttonStyle', + configs: { + options: [ + { label: '1', value: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white' }, + { label: '2', value: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white' }, + { label: '3', value: 'transition hover:bg-white border-2 border-solid border-white hover:text-black bg-gray-200 text-white' }, + ], + }, + defaultValue: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white', + }, ], } ], diff --git a/app/sections/image-with-text/content-item/description-item.tsx b/app/sections/image-with-text/content-item/description-item.tsx index 1137a1c..09cff17 100644 --- a/app/sections/image-with-text/content-item/description-item.tsx +++ b/app/sections/image-with-text/content-item/description-item.tsx @@ -3,17 +3,24 @@ import type { HydrogenComponentSchema, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; +import { CSSProperties } from 'react'; interface DescriptionItemProps extends HydrogenComponentProps { descriptionText: string; + descriptionSize: string; + descriptionColor: string; } let ImageWTextDescriptionItem = forwardRef((props, ref) => { - let { descriptionText, ...rest } = props; + let { descriptionText, descriptionSize, descriptionColor, ...rest } = props; + let styleDescription: CSSProperties = { + fontSize: descriptionSize, + color: descriptionColor, + } as CSSProperties; return (
-

{descriptionText}

+

{descriptionText}

); }); @@ -34,6 +41,27 @@ export let schema: HydrogenComponentSchema = { name: 'descriptionText', defaultValue: 'Pair large text with an image to tell a story, explain a detail about your product, or describe a new promotion.', }, + { + type: 'toggle-group', + label: 'Text size', + name: 'descriptionSize', + configs: { + options: [ + { label: 'XS', value: '14px' }, + { label: 'S', value: '16px' }, + { label: 'M', value: '18px' }, + { label: 'L', value: '20px' }, + { label: 'XL', value: '22px' }, + ], + }, + defaultValue: '16px', + }, + { + type: 'color', + name: 'descriptionColor', + label: 'Description color', + defaultValue: '#333333', + }, ], } ], diff --git a/app/sections/image-with-text/content-item/heading-item.tsx b/app/sections/image-with-text/content-item/heading-item.tsx index 14dc971..a395421 100644 --- a/app/sections/image-with-text/content-item/heading-item.tsx +++ b/app/sections/image-with-text/content-item/heading-item.tsx @@ -3,22 +3,18 @@ import type { HydrogenComponentSchema, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; -import { CSSProperties } from 'react'; interface HeadingItemProps extends HydrogenComponentProps { heading: string; - headingSize: string; + headingColor: string; } let ImageWTextHeadingItem = forwardRef((props, ref) => { - let { heading, headingSize, ...rest } = props; - let styleSubheading: CSSProperties = { - fontSize: headingSize, - } as CSSProperties; + let { heading, headingColor, ...rest } = props; return ( -
-

{heading}

+
+

{heading}

); }); @@ -41,19 +37,10 @@ export let schema: HydrogenComponentSchema = { placeholder: 'Heading for image section', }, { - type: 'toggle-group', - label: 'Heading size', - name: 'headingSize', - configs: { - options: [ - { label: 'XS', value: '22px' }, - { label: 'S', value: '24px' }, - { label: 'M', value: '26px' }, - { label: 'L', value: '28px' }, - { label: 'XL', value: '30px' }, - ], - }, - defaultValue: '24px', + type: 'color', + name: 'headingColor', + label: 'Heading color', + defaultValue: '#333333', }, ], } diff --git a/app/sections/image-with-text/content-item/subheading-item.tsx b/app/sections/image-with-text/content-item/subheading-item.tsx new file mode 100644 index 0000000..a93ce8b --- /dev/null +++ b/app/sections/image-with-text/content-item/subheading-item.tsx @@ -0,0 +1,68 @@ +import type { + HydrogenComponentProps, + HydrogenComponentSchema, +} from '@weaverse/hydrogen'; +import { forwardRef } from 'react'; +import { CSSProperties } from 'react'; + +interface SubheadingProps extends HydrogenComponentProps { + subHeading: string; + subHeadingSize: string; + subHeadingColor: string; +} + +let ImageWTextSubheadingItem = forwardRef((props, ref) => { + let { subHeading, subHeadingSize, subHeadingColor, ...rest } = props; + let styleContent: CSSProperties = { + fontSize: subHeadingSize, + color: subHeadingColor, + } as CSSProperties; + return ( +
+ {subHeading &&

{subHeading}

} +
+ ); +}); + +export default ImageWTextSubheadingItem; + +export let schema: HydrogenComponentSchema = { + type: 'subheading-image--Item', + title: 'Subheading item', + limit: 1, + inspector: [ + { + group: 'Subheading', + inputs: [ + { + type: 'text', + name: 'subHeading', + label: 'Subheading', + defaultValue: 'Subheading', + placeholder: 'Subheading', + }, + { + type: 'toggle-group', + label: 'Subheading size', + name: 'subHeadingSize', + configs: { + options: [ + { label: 'XS', value: '14px' }, + { label: 'S', value: '16px' }, + { label: 'M', value: '18px' }, + { label: 'L', value: '20px' }, + { label: 'XL', value: '22px' }, + ], + }, + defaultValue: '16px', + }, + { + type: 'color', + name: 'subHeadingColor', + label: 'Subheading color', + defaultValue: '#333333', + }, + ], + } + ], +}; diff --git a/app/sections/image-with-text/image-with-text.tsx b/app/sections/image-with-text/image-with-text.tsx index 992b751..24e19fd 100644 --- a/app/sections/image-with-text/image-with-text.tsx +++ b/app/sections/image-with-text/image-with-text.tsx @@ -1,26 +1,43 @@ import type { HydrogenComponentProps, HydrogenComponentSchema, + WeaverseImage, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; import { CSSProperties } from 'react'; +import { Image } from '@shopify/hydrogen'; +import { IconImageBlank } from '~/components'; interface ImageWithTextProps extends HydrogenComponentProps { + image: WeaverseImage, textAlignment: string; + sectionHeight: number; + backgroundColor: string; + loading: HTMLImageElement['loading']; } let ImageWithText = forwardRef((props, ref) => { - let { textAlignment, children, ...rest } = props; + let { textAlignment, image, sectionHeight, backgroundColor, loading, children, ...rest } = props; let styleSection: CSSProperties = { - '--section-height': '410px', + '--section-height': `${sectionHeight}px`, + backgroundColor: backgroundColor, textAlign: `${textAlignment}`, } as CSSProperties; return ( -
-
-
- {children} +
+
+
+
+ {children} +
+
+ {image ? : +
+ +
+ } +
@@ -37,6 +54,11 @@ export let schema: HydrogenComponentSchema = { { group: 'Image', inputs: [ + { + type: 'image', + name: 'image', + label: 'Image', + }, { type: 'toggle-group', label: 'Text alignment', @@ -50,17 +72,60 @@ export let schema: HydrogenComponentSchema = { }, defaultValue: 'left', }, + { + type: 'range', + name: 'sectionHeight', + label: 'Section height', + defaultValue: 450, + configs: { + min: 400, + max: 700, + step: 10, + unit: 'px', + }, + }, + { + type: 'color', + name: 'backgroundColor', + label: 'Background color', + defaultValue: '#f4f4f4', + }, + { + type: 'toggle-group', + name: 'loading', + label: 'Image loading', + defaultValue: 'eager', + configs: { + options: [ + { label: 'Eager', value: 'eager', icon: 'Lightning' }, + { + label: 'Lazy', + value: 'lazy', + icon: 'SpinnerGap', + weight: 'light', + }, + ], + }, + helpText: + 'Learn more about image loading strategies.', + }, ], }, ], - childTypes: ['Content--Item','Image--Component'], + childTypes: ['subheading-image--Item', 'Heading--Item', 'Description--Item', 'Button--Item'], presets: { children: [ { - type: 'Content--Item', + type: 'subheading-image--Item', + }, + { + type: 'Heading--Item', + }, + { + type: 'Description--Item', }, { - type: 'Image--Component', + type: 'Button--Item', }, ], }, diff --git a/app/sections/promotion-grid/item.tsx b/app/sections/promotion-grid/item.tsx new file mode 100644 index 0000000..1cae73a --- /dev/null +++ b/app/sections/promotion-grid/item.tsx @@ -0,0 +1,196 @@ +import type { + HydrogenComponentProps, + HydrogenComponentSchema, + WeaverseImage, +} from '@weaverse/hydrogen'; +import { forwardRef } from 'react'; +import { Image } from '@shopify/hydrogen'; +import {IconImageBlank} from '~/components'; +import clsx from 'clsx'; + +interface PromotionItemProps extends HydrogenComponentProps { + backgroundImage: WeaverseImage; + subHeading: string; + subHeadingSize: string; + subHeadingColor: string; + heading: string; + headingColor: string; + descriptionText: string; + descriptionSize: string; + descriptionColor: string; + buttonLabel1: string; + buttonLink1: string; + buttonLabel2: string; + buttonLink2: string; + openInNewTab: boolean; + buttonStyle1: string; + buttonStyle2: string; +} + +let PromotionGridItem = forwardRef((props, ref) => { + let { backgroundImage, subHeading, subHeadingSize, subHeadingColor, heading, headingColor, descriptionText, descriptionSize, descriptionColor, buttonLabel1, buttonLink1, buttonLabel2, buttonLink2, openInNewTab, buttonStyle1, buttonStyle2, ...rest } = props; + return ( +
+
+ {backgroundImage ? : +
+ +
} +
+
+
+ {subHeading &&

{subHeading}

} + {heading &&

{heading}

} + {descriptionText &&

{descriptionText}

} +
+ {buttonLabel1 && {buttonLabel1}} + {buttonLabel2 && {buttonLabel2}} +
+
+
+
+ ); +}); + +export default PromotionGridItem; + +export let schema: HydrogenComponentSchema = { + type: 'promotion-item', + title: 'Promotion item', + inspector: [ + { + group: 'Promotion item', + inputs: [ + { + type: 'image', + name: 'backgroundImage', + label: 'Background image', + }, + { + type: 'text', + name: 'subHeading', + label: 'Subheading', + defaultValue: 'Subheading', + placeholder: 'Subheading', + }, + { + type: 'toggle-group', + label: 'Subheading size', + name: 'subHeadingSize', + configs: { + options: [ + { label: 'XS', value: '14px' }, + { label: 'S', value: '16px' }, + { label: 'M', value: '18px' }, + { label: 'L', value: '20px' }, + { label: 'XL', value: '22px' }, + ], + }, + defaultValue: '16px', + }, + { + type: 'color', + name: 'subHeadingColor', + label: 'Subheading color', + defaultValue: '#333333', + }, + { + type: 'text', + name: 'heading', + label: 'Heading', + defaultValue: 'Heading for Image', + placeholder: 'Heading for image section', + }, + { + type: 'color', + name: 'headingColor', + label: 'Heading color', + defaultValue: '#333333', + }, + { + type: 'textarea', + name: 'descriptionText', + label: 'Text', + defaultValue: 'Include the smaller details of your promotion in text below the title.', + }, + { + type: 'toggle-group', + label: 'Description size', + name: 'descriptionSize', + configs: { + options: [ + { label: 'XS', value: '14px' }, + { label: 'S', value: '16px' }, + { label: 'M', value: '18px' }, + { label: 'L', value: '20px' }, + { label: 'XL', value: '22px' }, + ], + }, + defaultValue: '16px', + }, + { + type: 'color', + name: 'descriptionColor', + label: 'Description color', + defaultValue: '#333333', + }, + { + type: 'text', + name: 'buttonLabel1', + label: 'Button label 1', + defaultValue: 'Button', + }, + { + type: 'text', + name: 'buttonLink1', + label: 'Button #1 link', + placeholder: 'https://', + }, + { + type: 'text', + name: 'buttonLabel2', + label: 'Button label 2', + defaultValue: 'Button', + }, + { + type: 'text', + name: 'buttonLink2', + label: 'Button #2 link', + placeholder: 'https://', + }, + { + type: 'switch', + name: 'openInNewTab', + label: 'Open in new tab', + defaultValue: true, + }, + { + type: 'toggle-group', + label: 'Button style #1', + name: 'buttonStyle1', + configs: { + options: [ + { label: '1', value: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white' }, + { label: '2', value: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white' }, + { label: '3', value: 'transition hover:bg-white border-2 border-solid border-white hover:text-black bg-gray-200 text-white' }, + ], + }, + defaultValue: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white', + }, + { + type: 'toggle-group', + label: 'Button style #2', + name: 'buttonStyle2', + configs: { + options: [ + { label: '1', value: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white' }, + { label: '2', value: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white' }, + { label: '3', value: 'transition hover:bg-white border-2 border-solid border-white hover:text-black bg-gray-200 text-white' }, + ], + }, + defaultValue: 'transition hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white', + }, + ], + }, + ], +}; diff --git a/app/sections/promotion-grid/promotion-grid.tsx b/app/sections/promotion-grid/promotion-grid.tsx new file mode 100644 index 0000000..d9a3c7d --- /dev/null +++ b/app/sections/promotion-grid/promotion-grid.tsx @@ -0,0 +1,89 @@ +import type { + HydrogenComponentProps, + HydrogenComponentSchema, +} from '@weaverse/hydrogen'; +import { forwardRef } from 'react'; +import { CSSProperties } from 'react'; + +interface PromotionProps extends HydrogenComponentProps { + gap: number; + topPadding: number; + bottomPadding: number; +} + +let PromotionGrid = forwardRef((props, ref) => { + let {gap, topPadding, bottomPadding, children, ...rest } = props; + let spacingStyle: CSSProperties = { + gap: `${gap}px`, + paddingTop: `${topPadding}px`, + paddingBottom: `${bottomPadding}px`, + } as CSSProperties; + return ( +
+
+
+ {children} +
+
+
+ ); +}); + +export default PromotionGrid; + +export let schema: HydrogenComponentSchema = { + type: 'promotion-grid', + title: 'Promotion grid', + toolbar: ['general-settings', ['duplicate', 'delete']], + inspector: [ + { + group: 'Promotion', + inputs: [ + { + type: 'range', + name: 'gap', + label: 'Gap', + defaultValue: 30, + configs: { + min: 20, + max: 50, + step: 10, + unit: 'px', + }, + }, + { + type: 'range', + name: 'topPadding', + label: 'Top padding', + defaultValue: 40, + configs: { + min: 10, + max: 100, + step: 10, + unit: 'px', + }, + }, + { + type: 'range', + name: 'bottomPadding', + label: 'Bottom padding', + defaultValue: 40, + configs: { + min: 10, + max: 100, + step: 10, + unit: 'px', + }, + }, + ], + }, + ], + childTypes: ['promotion-item'], + presets: { + children: [ + { + type: 'promotion-item', + }, + ], + }, +}; diff --git a/app/weaverse/components.ts b/app/weaverse/components.ts index 75e76d0..0137a77 100644 --- a/app/weaverse/components.ts +++ b/app/weaverse/components.ts @@ -20,16 +20,15 @@ import * as TestimonialItem from '~/sections/testimonial/item'; import * as Video from '~/sections/video'; import * as CollectionHeader from '~/sections/collection-header'; import * as HeaderImage from '~/sections/header-image/header-image'; +import * as ImageWTextSubheadingItem from '~/sections/image-with-text/content-item/subheading-item'; import * as HeadingItem from '~/sections/header-image/heading-item'; import * as SubHeadingItem from '~/sections/header-image/subheading-item'; import * as DescriptionTextItem from '~/sections/header-image/description-text-item'; +import * as ButtonItem from '~/sections/header-image/button-image-item'; import * as ImageWithText from '~/sections/image-with-text/image-with-text'; import * as ImageWTextHeadingItem from '~/sections/image-with-text/content-item/heading-item'; import * as ImageWTextDescriptionItem from '~/sections/image-with-text/content-item/description-item'; import * as ImageWTextButtonItem from '~/sections/image-with-text/content-item/button-item'; -import * as ImageComponent from '~/sections/image-with-text/images-item/images'; -import * as ImageItems from '~/sections/image-with-text/images-item/item'; -import * as ContentComponent from '~/sections/image-with-text/content-item/index'; import * as ContentColumnWithImage from '~/sections/column-with-text/index'; import * as ContentColumnItem from '~/sections/column-with-text/item'; import * as RichText from '~/sections/rich-text/index'; @@ -42,6 +41,8 @@ import * as VideoHeadingItem from '~/sections/video-with-text/video-heading-item import * as VideoDescriptionItem from '~/sections/video-with-text/video-description-item'; import * as VideoButtonItem from '~/sections/video-with-text/video-button-item'; import * as Map from '~/sections/map'; +import * as PromotionGrid from '~/sections/promotion-grid/promotion-grid'; +import * as PromotionGridItem from '~/sections/promotion-grid/item'; export let components: HydrogenComponent[] = [ Main, @@ -53,13 +54,12 @@ export let components: HydrogenComponent[] = [ HeadingItem, SubHeadingItem, DescriptionTextItem, + ButtonItem, ImageWithText, - ContentComponent, + ImageWTextSubheadingItem, ImageWTextHeadingItem, ImageWTextDescriptionItem, ImageWTextButtonItem, - ImageComponent, - ImageItems, ContentColumnWithImage, ContentColumnItem, RichText, @@ -72,6 +72,8 @@ export let components: HydrogenComponent[] = [ VideoDescriptionItem, VideoButtonItem, Map, + PromotionGrid, + PromotionGridItem, Blogs, BlogPost, AllProducts,