diff --git a/app/routes/($locale)._index.jsx b/app/routes/($locale)._index.jsx index 39cbbac..72f9266 100644 --- a/app/routes/($locale)._index.jsx +++ b/app/routes/($locale)._index.jsx @@ -4,6 +4,9 @@ import {Await, useLoaderData, useFetcher, Link} from '@remix-run/react'; import { AnalyticsPageType } from '@shopify/hydrogen'; import { flattenConnection } from '@shopify/hydrogen-react' +import BlockContent from '@sanity/block-content-to-react' +import Serializer from '~/serializers/richText' + export async function loader({context}) { const collections = await context.storefront.query(COLLECTIONS_QUERY) const pages = await context.storefront.query(PAGES_QUERY) @@ -11,8 +14,20 @@ export async function loader({context}) { const articles = await context.storefront.query(ARTICLES_QUERY) const sanityPage = await context.sanity.fetch(` - *[_type == "home"] { - ... + *[_type == 'home'] { + ..., + modules[] { + _type, + _key, + (_type == 'module.hero') => { + 'bgColor': bgColor.hex, + 'image': image.asset-> { + metadata, + url + }, + text + } + } }[0]`) // We're not covering accounts/auth in this class @@ -55,24 +70,30 @@ export default function Homepage() {
{props.children}
; } else if (style === 'script') { diff --git a/app/styles/app.css b/app/styles/app.css index f46e817..455f575 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -1782,6 +1782,10 @@ select { font-size: 64px; line-height: 80px; } +.text-mono-82 { + font-size: 82px; + line-height: 100px; +} .font-400 { font-weight: 400; } diff --git a/cms/schemas/documents/home.js b/cms/schemas/documents/home.js index fbcea61..686dc21 100644 --- a/cms/schemas/documents/home.js +++ b/cms/schemas/documents/home.js @@ -33,10 +33,11 @@ export default defineField({ title: 'Modules', type: 'array', of: [ - {type: 'module.callout'}, - {type: 'module.callToAction'}, - {type: 'module.image'}, - {type: 'module.product'}, + {type: 'module.hero'}, + // {type: 'module.callout'}, + // {type: 'module.callToAction'}, + // {type: 'module.image'}, + // {type: 'module.product'}, ], group: 'editorial', }), diff --git a/cms/schemas/index.js b/cms/schemas/index.js index 515da13..f8b34a8 100644 --- a/cms/schemas/index.js +++ b/cms/schemas/index.js @@ -73,6 +73,7 @@ import moduleImage from './objects/module/image' import moduleImages from './objects/module/images' import moduleProduct from './objects/module/product' import moduleProducts from './objects/module/products' +import moduleHero from './objects/module/hero' import moduleStandardText from './objects/module/standardText' import placeholderString from './objects/placeholderString' import productHotspots from './objects/productHotspots' @@ -98,6 +99,7 @@ const objects = [ moduleCallToAction, moduleImage, moduleImages, + moduleHero, moduleProduct, moduleProducts, diff --git a/cms/schemas/objects/module/hero.js b/cms/schemas/objects/module/hero.js new file mode 100644 index 0000000..86ab2d6 --- /dev/null +++ b/cms/schemas/objects/module/hero.js @@ -0,0 +1,57 @@ +import React from 'react' +import {defineField, defineType} from 'sanity' +import {PackageIcon} from '@sanity/icons' + +import {COLORS} from '../../../constants' + +const GROUPS = [ + { + name: 'theme', + title: 'Theme', + }, + { + default: true, + name: 'editorial', + title: 'Editorial', + }, +] + +export default defineType({ + name: 'module.hero', + title: 'Hero', + type: 'object', + icon: PackageIcon, + groups: GROUPS, + fields: [ + + defineField({ + name: 'text', + title: 'Text', + type: 'richText', + group: 'editorial' + }), + defineField({ + name: 'image', + title: 'Image', + type: 'image', + group: 'editorial' + }), + defineField({ + name: 'bgColor', + title: 'Background Color', + type: 'color', + group: 'theme', + options: { + colorList: COLORS, + }, + }), + ], + preview: { + select: {}, + prepare(selection) { + return { + title: 'Hero', + } + }, + }, +}) diff --git a/tailwind.config.js b/tailwind.config.js index 3079479..575171c 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -16,6 +16,7 @@ const FONT_SIZES = { 'mono-200': ['200px', '184px'], 'mono-120': ['120px', '136px'], 'mono-100': ['100px', '126px'], + 'mono-82': ['82px', '100px'], 'mono-64': ['64px', '80px'], 'mono-48': ['48px', '64px'], 'mono-36': ['36px', '52px'],