diff --git a/app/components/Icon.tsx b/app/components/Icon.tsx index a783636..1f879fc 100644 --- a/app/components/Icon.tsx +++ b/app/components/Icon.tsx @@ -329,3 +329,11 @@ export function IconImageBlank(props: IconProps) { ); } +export function IconVideoBlank(props: IconProps) { + return( + + + + + ); +} diff --git a/app/root.tsx b/app/root.tsx index a541cbb..e05f8b7 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -3,6 +3,7 @@ import { type LoaderFunctionArgs, type AppLoadContext, type SerializeFrom, + LinksFunction, } from '@shopify/remix-oxygen'; import { isRouteErrorResponse, diff --git a/app/sections/column-with-text/index.tsx b/app/sections/column-with-text/index.tsx index 37fea50..14a3d8b 100644 --- a/app/sections/column-with-text/index.tsx +++ b/app/sections/column-with-text/index.tsx @@ -7,24 +7,32 @@ import { CSSProperties } from 'react'; interface ContentColumnWithImageProps extends HydrogenComponentProps { heading: string; - headingSize: string; + textColor: string; + gap: number; headingAlignment: string; + topPadding: number; + bottomPadding: number; } let ContentColumnWithImage = forwardRef((props, ref) => { - let {heading, headingSize, headingAlignment, children, ...rest } = props; + let {heading, textColor, headingAlignment, gap, topPadding, bottomPadding, children, ...rest } = props; let headingStyle: CSSProperties = { justifyContent: `${headingAlignment}`, - fontSize: `${headingSize}`, + } as CSSProperties; + let sectionStyle: CSSProperties = { + paddingTop: `${topPadding}px`, + paddingBottom: `${bottomPadding}px`, + '--text-color': `${textColor}`, + '--gap-item': `${gap}px`, } as CSSProperties; return ( -
-
-
-

{heading}

+
+
+
+

{heading}

-
+
{children}
@@ -50,19 +58,10 @@ export let schema: HydrogenComponentSchema = { placeholder: 'Heading for Image section', }, { - type: 'toggle-group', - label: 'Heading size', - name: 'headingSize', - configs: { - options: [ - { label: 'XS', value: '20px' }, - { label: 'S', value: '24px' }, - { label: 'M', value: '30px' }, - { label: 'L', value: '36px' }, - { label: 'XL', value: '40px' }, - ], - }, - defaultValue: '24px', + type: 'color', + name: 'textColor', + label: 'Text color', + defaultValue: '#000000', }, { type: 'toggle-group', @@ -77,6 +76,42 @@ export let schema: HydrogenComponentSchema = { }, defaultValue: 'center', }, + { + type: 'range', + name: 'gap', + label: 'Gap', + defaultValue: 20, + configs: { + min: 10, + max: 50, + step: 1, + unit: 'px', + }, + }, + { + type: 'range', + name: 'topPadding', + label: 'Top padding', + defaultValue: 0, + configs: { + min: 0, + max: 100, + step: 5, + unit: 'px', + }, + }, + { + type: 'range', + name: 'bottomPadding', + label: 'Bottom padding', + defaultValue: 0, + configs: { + min: 0, + max: 100, + step: 5, + unit: 'px', + }, + }, ], }, ], diff --git a/app/sections/column-with-text/item.tsx b/app/sections/column-with-text/item.tsx index 0b19ea8..47b47bf 100644 --- a/app/sections/column-with-text/item.tsx +++ b/app/sections/column-with-text/item.tsx @@ -1,24 +1,23 @@ import type { HydrogenComponentProps, HydrogenComponentSchema, + WeaverseImage, } from '@weaverse/hydrogen'; -import {forwardRef} from 'react'; -import {Image} from '@shopify/hydrogen'; +import { forwardRef } from 'react'; +import { Image } from '@shopify/hydrogen'; import clsx from 'clsx'; -import {CSSProperties} from 'react'; +import { CSSProperties } from 'react'; +import { IconImageBlank } from '~/components'; interface ContentColumnItemProps extends HydrogenComponentProps { - imageSrc: { - url: string; - altText: string; - width?: number; - height?: number; - }; + imageSrc: WeaverseImage; titleText: string; contentAlignment: string; descriptionText: string; buttonLabel: string; buttonLink: string; + openInNewTab: boolean; + buttonStyle: string; hideOnMobile: boolean; } @@ -31,6 +30,8 @@ let ContentColumnItem = forwardRef( descriptionText, buttonLabel, buttonLink, + openInNewTab, + buttonStyle, hideOnMobile, ...rest } = props; @@ -42,27 +43,30 @@ let ContentColumnItem = forwardRef( ref={ref} {...rest} className={clsx( - 'flex flex-col items-center pt-8 sm-max:w-full sm-max:pt-0', + 'flex flex-col items-center sm-max:w-full sm-max:pt-0', hideOnMobile && 'hidden sm:block', )} >
- + {imageSrc ? : +
+ +
}
{titleText && ( -

{titleText}

+

{titleText}

)} {descriptionText && (

+ className="text-sm font-normal mt-2 text-[var(--text-color)]" + >{descriptionText}

)} {buttonLabel && ( {buttonLabel} @@ -86,13 +90,6 @@ export let schema: HydrogenComponentSchema = { type: 'image', name: 'imageSrc', label: 'Image', - defaultValue: { - id: 'image-placeholder', - url: 'https://cdn.shopify.com/s/files/1/0728/0410/6547/files/pilot-image-placeholder.svg', - altText: 'Image index', - width: 0, - height: 0, - }, }, { type: 'text', @@ -107,15 +104,15 @@ export let schema: HydrogenComponentSchema = { name: 'contentAlignment', configs: { options: [ - {label: 'Left', value: 'left'}, - {label: 'Center', value: 'center'}, - {label: 'Right', value: 'right'}, + { label: 'Left', value: 'left' }, + { label: 'Center', value: 'center' }, + { label: 'Right', value: 'right' }, ], }, defaultValue: 'center', }, { - type: 'richtext', + type: 'textarea', label: 'Text', name: 'descriptionText', placeholder: 'Brief description', @@ -134,6 +131,25 @@ export let schema: HydrogenComponentSchema = { name: 'buttonLink', placeholder: 'Button link', }, + { + 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 hover:bg-white border-2 border-solid hover:border-gray-900 hover:text-black bg-black text-white', + }, { type: 'switch', label: 'Hide on Mobile', diff --git a/app/sections/header-image/description-text-item.tsx b/app/sections/header-image/description-text-item.tsx index 6d3b598..f0b09b1 100644 --- a/app/sections/header-image/description-text-item.tsx +++ b/app/sections/header-image/description-text-item.tsx @@ -27,7 +27,7 @@ export default DescriptionTextItem; export let schema: HydrogenComponentSchema = { type: 'description-text--item', - title: 'Descripttion text item', + title: 'Description text item', inspector: [ { group: 'Description text', diff --git a/app/sections/rich-text/descriptions-item.tsx b/app/sections/rich-text/descriptions-item.tsx index 4337de1..5bb6382 100644 --- a/app/sections/rich-text/descriptions-item.tsx +++ b/app/sections/rich-text/descriptions-item.tsx @@ -11,7 +11,7 @@ interface DescriptionItemProps extends HydrogenComponentProps { let RichTextDescriptionItem = forwardRef((props, ref) => { let { descriptionText, ...rest } = props; return ( -

+

); }); diff --git a/app/sections/rich-text/headings-item.tsx b/app/sections/rich-text/headings-item.tsx index 269922e..4888e1d 100644 --- a/app/sections/rich-text/headings-item.tsx +++ b/app/sections/rich-text/headings-item.tsx @@ -11,7 +11,7 @@ interface HeadingItemProps extends HydrogenComponentProps { let RichTextHeadingItem = forwardRef((props, ref) => { let { heading, ...rest } = props; return ( -

{heading}

+

{heading}

); }); diff --git a/app/sections/rich-text/index.tsx b/app/sections/rich-text/index.tsx index 7106cb3..0fdb359 100644 --- a/app/sections/rich-text/index.tsx +++ b/app/sections/rich-text/index.tsx @@ -9,14 +9,20 @@ interface RichTextProps extends HydrogenComponentProps { contentAlignment: string; sectionHeight: string; backgroundColor: string; + textColor: string; + topPadding: string; + bottomPadding: string; } let RichText = forwardRef((props, ref) => { - let { contentAlignment, sectionHeight, backgroundColor, children, ...rest } = props; + let { contentAlignment, sectionHeight, backgroundColor, textColor, topPadding, bottomPadding, children, ...rest } = props; let sectionStyle: CSSProperties = { alignItems: `${contentAlignment}`, '--section-height': `${sectionHeight}px`, backgroundColor: `${backgroundColor}`, + '--text-color': `${textColor}`, + paddingTop: `${topPadding}px`, + paddingBottom: `${bottomPadding}px`, } as CSSProperties; return (
@@ -43,6 +49,12 @@ export let schema: HydrogenComponentSchema = { label: 'Background color', defaultValue: '#F7F7F7', }, + { + type: 'color', + name: 'textColor', + label: 'Text color', + defaultValue: '#000000', + }, { type: 'toggle-group', label: 'Content alignment', @@ -68,6 +80,30 @@ export let schema: HydrogenComponentSchema = { 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', + }, + }, ], }, ], diff --git a/app/sections/testimonial/index.tsx b/app/sections/testimonial/index.tsx index c0e1021..7a22471 100644 --- a/app/sections/testimonial/index.tsx +++ b/app/sections/testimonial/index.tsx @@ -1,6 +1,9 @@ import { type HydrogenComponentProps, type HydrogenComponentSchema, + useChildInstances, + useItemInstance, + useParentInstance, } from '@weaverse/hydrogen'; import {forwardRef} from 'react'; @@ -11,6 +14,10 @@ interface TestimonialProps extends HydrogenComponentProps { let Testimonial = forwardRef((props, ref) => { let {heading, description, children, ...rest} = props; + + let itemInstance = useItemInstance(); + let parentInstance = useParentInstance(); + let childInstances = useChildInstances(); return (
diff --git a/app/sections/video-with-text/video-button-item.tsx b/app/sections/video-with-text/video-button-item.tsx index 6f963cc..ed8b98a 100644 --- a/app/sections/video-with-text/video-button-item.tsx +++ b/app/sections/video-with-text/video-button-item.tsx @@ -3,18 +3,20 @@ import type { HydrogenComponentSchema, } from '@weaverse/hydrogen'; import { forwardRef } from 'react'; +import clsx from 'clsx'; interface VideoButtonProps extends HydrogenComponentProps { buttonLabel: string; buttonLink: string; enableNewtab: boolean; + buttonStyle: string; } let VideoButtonItem = forwardRef((props, ref) => { - let {buttonLabel, buttonLink, enableNewtab, ...rest} = props; + let {buttonLabel, buttonLink, enableNewtab, buttonStyle, ...rest} = props; return ( ); }); @@ -53,12 +55,12 @@ export let schema: HydrogenComponentSchema = { name: 'buttonStyle', configs: { options: [ - { label: '1', value: '1' }, - { label: '2', value: '2' }, - { label: '3', value: '3' }, + { 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: '1', + defaultValue: 'transition bg-white border-2 border-solid border-gray-900 text-black hover:bg-black hover:text-white', }, ], }, diff --git a/app/sections/video-with-text/video-heading-item.tsx b/app/sections/video-with-text/video-heading-item.tsx index 77aabac..a3b73d1 100644 --- a/app/sections/video-with-text/video-heading-item.tsx +++ b/app/sections/video-with-text/video-heading-item.tsx @@ -6,15 +6,14 @@ import { forwardRef } from 'react'; interface VideoHeadingProps extends HydrogenComponentProps { heading: string; - headingSize: string; headingColor: string; } let VideoHeadingItem = forwardRef((props, ref) => { - let {heading, headingSize, headingColor, ...rest} = props; + let {heading, headingColor, ...rest} = props; return (
-

{heading}

+

{heading}

); }); @@ -36,21 +35,6 @@ export let schema: HydrogenComponentSchema = { defaultValue: 'Heading for Video', placeholder: 'Heading for video 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', diff --git a/app/sections/video-with-text/video-with-text.tsx b/app/sections/video-with-text/video-with-text.tsx index 2e15258..700c93a 100644 --- a/app/sections/video-with-text/video-with-text.tsx +++ b/app/sections/video-with-text/video-with-text.tsx @@ -5,6 +5,7 @@ import type { import { forwardRef } from 'react'; import { CSSProperties } from 'react'; import ReactPlayer from 'react-player/youtube'; +import { IconVideoBlank } from '~/components'; interface VideoWithTextProps extends HydrogenComponentProps { videoLink: string; @@ -39,10 +40,7 @@ let VideoWithText = forwardRef((props, ref) => className='absolute aspect-video' controls={false} /> :
- - - - +
} {enableOverlay &&
}
@@ -157,10 +155,10 @@ export let schema: HydrogenComponentSchema = { presets: { children: [ { - type: 'video-heading--item', + type: 'video-subheading--item', }, { - type: 'video-subheading--item', + type: 'video-heading--item', }, { type: 'video-description--item', diff --git a/app/weaverse/create-weaverse.server.ts b/app/weaverse/create-weaverse.server.ts index d9714c5..24b658a 100644 --- a/app/weaverse/create-weaverse.server.ts +++ b/app/weaverse/create-weaverse.server.ts @@ -37,6 +37,7 @@ export function getWeaverseCsp(request: Request) { 'https://shopify.com', 'https://*.youtube.com', 'https://fonts.gstatic.com', + 'https://*.google.com', ...weaverseHosts, ], imgSrc: [ diff --git a/app/weaverse/schema.server.ts b/app/weaverse/schema.server.ts index c8d6d6a..49a61ea 100644 --- a/app/weaverse/schema.server.ts +++ b/app/weaverse/schema.server.ts @@ -21,7 +21,7 @@ export let themeSchema: HydrogenThemeSchema = { label: 'Logo', defaultValue: { id: 'gid://shopify/MediaImage/34144817938616', - alt: '', + altText: 'Logo', url: 'https://cdn.shopify.com/s/files/1/0623/5095/0584/files/Pilot_logo_b04f1938-06e5-414d-8a47-d5fcca424000.png?v=1697101908', width: 320, height: 116, diff --git a/package.json b/package.json index 04fbe71..6d97dc5 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@shopify/cli-hydrogen": "^6.0.2", "@shopify/hydrogen": "^2023.10.2", "@shopify/remix-oxygen": "^2.0.1", - "@weaverse/hydrogen": "^2.4.3", + "@weaverse/hydrogen": "2.5.0", "clsx": "2.0.0", "cross-env": "7.0.3", "graphql": "16.8.1",