Skip to content

Commit

Permalink
lesson 1.3 file updates
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkevingreen committed Aug 5, 2023
1 parent 266f285 commit ba68e63
Show file tree
Hide file tree
Showing 15 changed files with 1,379 additions and 1,186 deletions.
11 changes: 10 additions & 1 deletion app/routes/($locale)._index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ export async function loader({context}) {
const products = await context.storefront.query(PRODUCT_QUERY)
const articles = await context.storefront.query(ARTICLES_QUERY)

const sanityPage = await context.sanity.fetch(`
*[_type == "home"] {
...
}[0]`)

// We're not covering accounts/auth in this class
// const customerAccessToken = await context.session.get('customerAccessToken');
// const customer = customerAccessToken ?
// await getCustomer(context, customerAccessToken)
// : false

return {
sanityPage,
collections,
pages,
articles,
Expand All @@ -36,7 +42,7 @@ export const handle = {
export default function Homepage() {

const fetcher = useFetcher();
const {collections, pages, products, articles} = useLoaderData()
const {collections, sanityPage, pages, products, articles} = useLoaderData()

const pagesArray = flattenConnection(pages.pages)
const productArray = flattenConnection(products.products)
Expand All @@ -46,6 +52,9 @@ export default function Homepage() {
return (
<div className='relative'>
<>
<div className='min-h-screen flex justify-center items-center'>
<h2 className='text-mono-64'>{sanityPage.title}</h2>
</div>
{/* Let's make sure to remove the 80px from the sticky top */}
<div className='min-h-[calc(100vh-120px)] w-screen'>
{/* 2UP Module */}
Expand Down
2 changes: 1 addition & 1 deletion app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ select {
}
.text-mono-100 {
font-size: 100px;
line-height: 126x;
line-height: 126px;
}
.text-mono-12 {
font-size: 12px;
Expand Down
2 changes: 1 addition & 1 deletion cms/app/[[...index]]/loading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react'
import config from '../../sanity.config'
import NextStudioLoading from 'next-sanity/studio/loading'
import {NextStudioLoading} from 'next-sanity/studio/loading'

export default function Loading() {
return <NextStudioLoading config={config} />;
Expand Down
2 changes: 1 addition & 1 deletion cms/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const DEFAULT_CURRENCY_CODE = 'USD'
// Document types which:
// - cannot be created in the 'new document' menu
// - cannot be duplicated, unpublished or deleted
export const LOCKED_DOCUMENT_TYPES = ['settings', 'home', 'media.tag']
export const LOCKED_DOCUMENT_TYPES = ['settings', 'media.tag']

// Document types which:
// - cannot be created in the 'new document' menu
Expand Down
20 changes: 3 additions & 17 deletions cms/desk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,13 @@ export const structure = (S, context) => {
.schemaType('page')
.icon(DocumentIcon)
.child(
S.documentTypeList('page')
.title('Pages')
.child(documentId =>
S.document()
.documentId(documentId)
.schemaType('page')
),
);
S.documentTypeList('page').title('Pages'))

const homePageMenuItem = S.listItem()
.title('Home Pages')
.schemaType('home')
.child(
S.documentTypeList('home')
.title('Home Pages')
.child(documentId =>
S.document()
.documentId(documentId)
.schemaType('information')
),
);
S.documentTypeList('home').title('Home'))

const allPageMenuItem = S.listItem()
.title('Pages')
Expand Down Expand Up @@ -218,7 +204,7 @@ export const structure = (S, context) => {
.child(S.editor().title('Settings').schemaType('settings').documentId('settings'))

return S.list()
.title('Content')
.title('Superhi')
.items([
allPageMenuItem,
S.divider(),
Expand Down
Loading

0 comments on commit ba68e63

Please sign in to comment.