Skip to content

Commit

Permalink
feat: replaces data source ref with cms prop to enable live previewin…
Browse files Browse the repository at this point in the history
…g with metaobject sections

* chore: warmly script for pack tracking on demo store

* feat: replace data source ref with cms prop for live previewing
  • Loading branch information
jeremyagabriel authored Mar 19, 2024
1 parent 5773675 commit 8120571
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
8 changes: 1 addition & 7 deletions app/sections/MetaobjectImage/MetaobjectImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import {Image, Link, Markdown} from '~/components';
import {Schema} from './MetaobjectImage.schema';

export function MetaobjectImage({cms}: {cms: Record<string, any>}) {
const dataSourceReference = cms?.dataSource?.reference;
const fields: Record<string, any> = {};
dataSourceReference?.fields?.forEach((field: Record<string, any>) => {
fields[field.key] = field.reference || field.value;
});

const {alt, link, caption, enable_padding, image} = fields;
const {alt, link, caption, enable_padding, image} = cms;
const imageDetails = image?.image;

const maxWidth = 'max-w-[90rem]';
Expand Down
8 changes: 1 addition & 7 deletions app/sections/MetaobjectTextBlock/MetaobjectTextBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@ import {Link, Markdown} from '~/components';
import {Schema} from './MetaobjectTextBlock.schema';

export function MetaobjectTextBlock({cms}: {cms: Record<string, any>}) {
const dataSourceReference = cms?.dataSource?.reference;
const fields: Record<string, any> = {};
dataSourceReference?.fields?.forEach((field: Record<string, any>) => {
fields[field.key] = field.reference || field.value;
});

const {
button_link,
button_link_text,
heading,
above_the_fold,
subtext,
full_width,
} = fields;
} = cms;
const maxWidthClass = full_width
? 'max-w-none'
: 'max-w-[var(--content-max-width)]';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hydrogen-starter",
"private": true,
"sideEffects": false,
"version": "1.0.0",
"version": "1.1.1",
"scripts": {
"dev": "shopify hydrogen dev --port 8080",
"build": "shopify hydrogen build",
Expand Down

0 comments on commit 8120571

Please sign in to comment.