Skip to content

Commit

Permalink
Run prettier on failing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevintjuhz committed Aug 4, 2023
1 parent 2c106cb commit c9db59d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
23 changes: 13 additions & 10 deletions examples/cms-prepr/README.md
Expand Up @@ -6,8 +6,8 @@ This example showcases Next.js's [Static Generation](https://nextjs.org/docs/bas

Check out our Blog page example:

* **Live**: [https://next-blog-prepr.vercel.app/](https://next-blog-prepr.vercel.app/)
* **Preview**: [https://next-blog-prepr.vercel.app/api/preview...](https://next-blog-prepr.vercel.app/api/preview?secret=237864ihasdhj283768&slug=blueberry-cheesecake)
- **Live**: [https://next-blog-prepr.vercel.app/](https://next-blog-prepr.vercel.app/)
- **Preview**: [https://next-blog-prepr.vercel.app/api/preview...](https://next-blog-prepr.vercel.app/api/preview?secret=237864ihasdhj283768&slug=blueberry-cheesecake)

## How to use

Expand Down Expand Up @@ -55,7 +55,7 @@ The `.env.local` file will be ignored by Git.

![Access tokens](https://assets-site.prepr.io//6jouln4xi3wp-default-access-tokens.png)

Copy the *GraphQL Production* access token and paste it as the `PREPRIO_PRODUCTION_TOKEN` variable in `.env.local`. Then copy and paste the *GraphQL Preview* access token as the `PREPRIO_PREVIEW_TOKEN` variable.
Copy the _GraphQL Production_ access token and paste it as the `PREPRIO_PRODUCTION_TOKEN` variable in `.env.local`. Then copy and paste the _GraphQL Preview_ access token as the `PREPRIO_PREVIEW_TOKEN` variable.

Alternatively, you can create access tokens yourself by clicking **Add access token**. If so, make sure to [choose the right GraphQL permissions](https://docs.prepr.io/reference/graphql/v1/authorization) for the access tokens.

Expand Down Expand Up @@ -83,6 +83,7 @@ npm install
```bash
yarn install
```

**3.2** Execute one of the following commands to run the dev script defined in the `package.json` file:

```bash
Expand All @@ -102,12 +103,13 @@ Before proceeding, you can test how the content preview works in Prepr. This ste

To try preview mode, follow these steps:

**4.1** In Prepr, go to one of the content items of the *Article model* and update the item title. For example, you can add *[PREVIEW]* in front of the title. After you edit the content item, save it with the *Review status*.
**4.1** In Prepr, go to one of the content items of the _Article model_ and update the item title. For example, you can add _[PREVIEW]_ in front of the title. After you edit the content item, save it with the _Review status_.

**4.2** To preview the content item, transform its URL to the following format:

`http://localhost:3000/api/preview?secret=<PREPRIO_PREVIEW_SECRET>&slug=<SLUG_TO_PREVIEW>`,
where:

- `<PREPRIO_PREVIEW_SECRET>` is the same preview secret you defined in the `.env.local` file;
- `<SLUG_TO_PREVIEW>` is the slug of the content item you want to preview.

Expand All @@ -121,22 +123,23 @@ To make your Next.js app available online, deploy it to the cloud using [Vercel]

You can go for one of the following options:

* **Deploy your local project**</br>
- **Deploy your local project**</br>
To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [import it to Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example).

**Important:** When you import your project on Vercel, make sure to click on **Environment Variables** and set them to match your `.env.local` file.

* **Deploy from our template**</br>
- **Deploy from our template**</br>
Alternatively, you can deploy using our template by clicking on the **Deploy** button below.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/cms-prepr&project-name=cms-prepr&repository-name=cms-prepr&env=PREPRIO_API,PREPRIO_PRODUCTION_TOKEN,PREPRIO_PREVIEW_TOKEN,PREPRIO_PREVIEW_SECRET&envDescription=Required%20to%20connect%20the%20app%20with%20Prepr&envLink=https://vercel.link/cms-prepr-env)

## Next steps

For more advanced topics, please refer to the Prepr’s documentation:
* [A/B testing](https://docs.prepr.io/optimization-and-personalization/ab-testing)
* [Personalization](https://docs.prepr.io/optimization-and-personalization/personalized-stack)
* [Recommendations](https://docs.prepr.io/optimization-and-personalization/recommendations)

- [A/B testing](https://docs.prepr.io/optimization-and-personalization/ab-testing)
- [Personalization](https://docs.prepr.io/optimization-and-personalization/personalized-stack)
- [Recommendations](https://docs.prepr.io/optimization-and-personalization/recommendations)

If you have questions, please [get in touch](https://prepr.io/get-in-touch) with one of our specialists or [join our Slack community](https://slack.prepr.io/).

Expand All @@ -158,4 +161,4 @@ If you have questions, please [get in touch](https://prepr.io/get-in-touch) with
- [GraphCMS](/examples/cms-graphcms)
- [Blog Starter](/examples/blog-starter)
- [DotCMS](/examples/cms-dotcms)
- [Enterspeed](/examples/cms-enterspeed)
- [Enterspeed](/examples/cms-enterspeed)
8 changes: 5 additions & 3 deletions examples/cms-prepr/components/hero-post.js
Expand Up @@ -23,9 +23,11 @@ export default function HeroPost({
{title}
</Link>
</h3>
{date && <div className="mb-4 md:mb-0 text-lg">
<Date dateString={date} />
</div>}
{date && (
<div className="mb-4 md:mb-0 text-lg">
<Date dateString={date} />
</div>
)}
</div>
<div>
<div
Expand Down
8 changes: 5 additions & 3 deletions examples/cms-prepr/components/post-header.js
Expand Up @@ -17,9 +17,11 @@ export default function PostHeader({ title, coverImage, date, author }) {
<div className="block md:hidden mb-6">
<Avatar name={author.full_name} picture={author.profile_pic[0].url} />
</div>
{date && <div className="mb-6 text-lg">
<Date dateString={date} />
</div>}
{date && (
<div className="mb-6 text-lg">
<Date dateString={date} />
</div>
)}
</div>
</>
)
Expand Down
8 changes: 5 additions & 3 deletions examples/cms-prepr/components/post-preview.js
Expand Up @@ -21,9 +21,11 @@ export default function PostPreview({
{title}
</Link>
</h3>
{date && <div className="text-lg mb-4">
<Date dateString={date} />
</div>}
{date && (
<div className="text-lg mb-4">
<Date dateString={date} />
</div>
)}
<div
className="text-lg leading-relaxed mb-4"
dangerouslySetInnerHTML={{ __html: excerpt }}
Expand Down
6 changes: 3 additions & 3 deletions examples/cms-prepr/lib/api.js
@@ -1,6 +1,6 @@
async function fetchAPI(query, { variables, preview } = {}) {
const response = await fetch(process.env.PREPRIO_API, {
method: "POST",
method: 'POST',
headers: {
Authorization:
'Bearer ' +
Expand All @@ -11,10 +11,10 @@ async function fetchAPI(query, { variables, preview } = {}) {
body: JSON.stringify({
query,
variables,
})
}),
})

const result = await response.json();
const result = await response.json()

return result
}
Expand Down

0 comments on commit c9db59d

Please sign in to comment.