-
Notifications
You must be signed in to change notification settings - Fork 26k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
819 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This file duplicates bunch of things from build_test_deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
is_dispatched: | ||
description: 'Leave this option enabled' | ||
required: true | ||
default: true | ||
type: boolean | ||
schedule: | ||
- cron: '0 */4 * * *' | ||
|
||
name: Test examples | ||
|
||
env: | ||
PNPM_VERSION: 7.24.3 | ||
|
||
jobs: | ||
testExamples: | ||
# Don't execute using cron on forks | ||
if: (github.repository == 'vercel/next.js') || (inputs.is_dispatched == true) | ||
name: Test Examples | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 120 | ||
env: | ||
NEXT_TELEMETRY_DISABLED: 1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [16, 18] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 25 | ||
# https://github.com/actions/virtual-environments/issues/1187 | ||
- name: tune linux network | ||
run: sudo ethtool -K eth0 tx off rx off | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
check-latest: true | ||
|
||
- run: npm i -g pnpm@${PNPM_VERSION} | ||
|
||
- run: pnpm install | ||
- run: pnpm build | ||
|
||
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-focal /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ matrix.node }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 NEXT_TEST_MODE=start xvfb-run node run-tests.js --type examples >> /proc/1/fd/1" | ||
name: Run test/examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { usePreview } from '../lib/sanity' | ||
import { indexQuery } from '../lib/queries' | ||
import Landing from './landing' | ||
|
||
export default function LandingPreview({ allPosts }) { | ||
const previewAllPosts = usePreview(null, indexQuery) | ||
return <Landing data={previewAllPosts ?? allPosts} preview /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Layout from './layout' | ||
import Head from 'next/head' | ||
import { CMS_NAME } from '../lib/constants' | ||
import Container from './container' | ||
import Intro from './intro' | ||
import HeroPost from './hero-post' | ||
import MoreStories from './more-stories' | ||
|
||
export default function Landing({ allPosts, preview }) { | ||
const [heroPost, ...morePosts] = allPosts || [] | ||
return ( | ||
<> | ||
<Layout preview={preview}> | ||
<Head> | ||
<title>{`Next.js Blog Example with ${CMS_NAME}`}</title> | ||
</Head> | ||
<Container> | ||
<Intro /> | ||
{heroPost && ( | ||
<HeroPost | ||
title={heroPost.title} | ||
coverImage={heroPost.coverImage} | ||
date={heroPost.date} | ||
author={heroPost.author} | ||
slug={heroPost.slug} | ||
excerpt={heroPost.excerpt} | ||
/> | ||
)} | ||
{morePosts.length > 0 && <MoreStories posts={morePosts} />} | ||
</Container> | ||
</Layout> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Avatar from '../components/avatar' | ||
import Date from '../components/date' | ||
import CoverImage from './cover-image' | ||
import Link from 'next/link' | ||
|
||
export default function PostPlug({ | ||
title, | ||
coverImage, | ||
date, | ||
excerpt, | ||
author, | ||
slug, | ||
}) { | ||
return ( | ||
<div> | ||
<div className="mb-5"> | ||
<CoverImage slug={slug} title={title} image={coverImage} /> | ||
</div> | ||
<h3 className="mb-3 text-3xl leading-snug"> | ||
<Link href={`/posts/${slug}`} className="hover:underline"> | ||
{title} | ||
</Link> | ||
</h3> | ||
<div className="mb-4 text-lg"> | ||
<Date dateString={date} /> | ||
</div> | ||
<p className="mb-4 text-lg leading-relaxed">{excerpt}</p> | ||
{author && <Avatar name={author.name} picture={author.picture} />} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,9 @@ | ||
import Avatar from '../components/avatar' | ||
import Date from '../components/date' | ||
import CoverImage from './cover-image' | ||
import Link from 'next/link' | ||
import { usePreview } from '../lib/sanity' | ||
import { postQuery } from '../lib/queries' | ||
import Post from './post' | ||
|
||
export default function PostPreview({ | ||
title, | ||
coverImage, | ||
date, | ||
excerpt, | ||
author, | ||
slug, | ||
}) { | ||
return ( | ||
<div> | ||
<div className="mb-5"> | ||
<CoverImage slug={slug} title={title} image={coverImage} /> | ||
</div> | ||
<h3 className="mb-3 text-3xl leading-snug"> | ||
<Link href={`/posts/${slug}`} className="hover:underline"> | ||
{title} | ||
</Link> | ||
</h3> | ||
<div className="mb-4 text-lg"> | ||
<Date dateString={date} /> | ||
</div> | ||
<p className="mb-4 text-lg leading-relaxed">{excerpt}</p> | ||
{author && <Avatar name={author.name} picture={author.picture} />} | ||
</div> | ||
) | ||
export default function PostPreview({ data }) { | ||
const slug = data?.post?.slug | ||
const previewData = usePreview(null, postQuery, { slug }) | ||
return <Post data={previewData ?? data} preview /> | ||
} |
Oops, something went wrong.