Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from brob/qa
Browse files Browse the repository at this point in the history
Qa
  • Loading branch information
brob authored Nov 4, 2020
2 parents b8f5ea3 + c4674d6 commit 5e5c7f3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
Binary file modified data/production.tar.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions template/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export default function Form ({_id}) {
<input ref={register} type="hidden" name="_id" value={_id} />
<label className="block mb-5">
<span className="text-gray-700">Name</span>
<input name="name" ref={register({required: true})} className="form-input mt-1 block w-full" placeholder="John Appleseed"/>
<input name="name" ref={register({required: true})} className="shadow border rounded py-2 px-3 form-input mt-1 block w-full" placeholder="John Appleseed"/>
</label>
<label className="block mb-5">
<span className="text-gray-700">Email</span>
<input name="email" type="email" ref={register({required: true})} className="form-input mt-1 block w-full" placeholder="[email protected]"/>
<input name="email" type="email" ref={register({required: true})} className="shadow border rounded py-2 px-3 form-input mt-1 block w-full" placeholder="[email protected]"/>
</label>
<label className="block mb-5">
<span className="text-gray-700">Comment</span>
<textarea ref={register({required: true})} name="comment" className="form-textarea mt-1 block w-full" rows="8" placeholder="Enter some long form content."></textarea>
<textarea ref={register({required: true})} name="comment" className="shadow border rounded py-2 px-3 form-textarea mt-1 block w-full" rows="8" placeholder="Enter some long form content."></textarea>
</label>
{/* errors will return when field validation fails */}
{errors.exampleRequired && <span>This field is required</span>}
Expand Down
2 changes: 1 addition & 1 deletion template/components/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Intro() {
href={CMS_URL}
className="underline hover:text-success duration-200 transition-colors"
>
{CMS_NAME}
Sanity.io
</a>
.
</h4>
Expand Down
1 change: 0 additions & 1 deletion template/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default function Layout({ preview, children }) {
<>
<Meta />
<div className="min-h-screen">
<Alert preview={preview} />
<main>{children}</main>
</div>
<Footer />
Expand Down
2 changes: 1 addition & 1 deletion template/components/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function Meta() {
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
<meta
name="description"
content={`A statically generated blog example using Next.js and ${CMS_NAME}.`}
content={`A statically generated blog example using Next.js and Sanity.io.`}
/>
<meta property="og:image" content={HOME_OG_IMAGE_URL} />
</Head>
Expand Down
4 changes: 2 additions & 2 deletions template/components/post-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Avatar from '../components/avatar'
import Date from '../components/date'
import CoverImage from './cover-image'
import Link from 'next/link'

import {imageBuilder} from '../lib/sanity'
export default function PostPreview({
title,
coverImage,
Expand All @@ -14,7 +14,7 @@ export default function PostPreview({
return (
<div>
<div className="mb-5">
<CoverImage slug={slug} title={title} url={coverImage} />
<CoverImage slug={slug} title={title} url={imageBuilder(coverImage).url()} />
</div>
<h3 className="text-3xl mb-3 leading-snug">
<Link as={`/posts/${slug}`} href="/posts/[slug]">
Expand Down
4 changes: 2 additions & 2 deletions template/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getClient = (preview) => (preview ? previewClient : client)

export async function getPreviewPostBySlug(slug) {
const data = await getClient(true).fetch(
`*[_type == "post" && slug.current == $slug] | order(dpublishedAtate desc){
`*[_type == "post" && slug.current == $slug] | order(publishedAt desc){
${postFields}
body
}`,
Expand All @@ -43,7 +43,7 @@ export async function getAllPostsWithSlug() {

export async function getAllPostsForHome(preview) {
const results = await getClient(preview)
.fetch(`*[_type == "post"] | order(date desc, _updatedAt desc){
.fetch(`*[_type == "post"] | order(publishedAt desc){
${postFields}
}`)
return getUniquePosts(results)
Expand Down
1 change: 1 addition & 0 deletions template/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ export async function getStaticProps({ preview = false }) {
const allPosts = await getAllPostsForHome(preview)
return {
props: { allPosts, preview },
revalidate: 1
}
}

0 comments on commit 5e5c7f3

Please sign in to comment.