Unverified Commit fec5318e authored by Maria Violante's avatar Maria Violante Committed by GitHub

Update buttercms example (#35436)

* remove old buttercms project files

* Updated .gitignore

* Add new buttercms files

* Add readme and remove name from package.json

* fix linting error

* Fix eslint

* Update examples/cms-buttercms/.gitignore
Co-authored-by: 's avatarLee Robinson <me@leerob.io>

* renamed .env.sample > .env.local.example

* remove dangerously allow svg

* Update examples/cms-buttercms/package.json
Co-authored-by: 's avatarLee Robinson <me@leerob.io>
parent 44f436b9
# Copy this file as .env.local
BUTTERCMS_API_KEY=
BUTTERCMS_PREVIEW_SECRET=
\ No newline at end of file
NEXT_PUBLIC_BUTTER_CMS_API_KEY=your_auth_token
\ No newline at end of file
# A statically generated blog example using Next.js and ButterCMS
# A fully-functional, drop-in proof-of-concept Next.js app using ButterCMS
This Next.js starter project fully integrates with dynamic sample content from your ButterCMS account, including main menu, pages, blog posts, categories, and tags, all with a beautiful, custom theme with already-implemented search functionality. All of the included sample content is automatically created in your account dashboard when you sign up for a free trial of ButterCMS.
A copy of this starter project can be easily and quickly deployed to Vercel with the click of a button.
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using [ButterCMS](https://buttercms.com/) as the data source.
## Demo
[https://next-blog-buttercms.vercel.app/](https://next-blog-buttercms.vercel.app/)
Check out our live demo: [https://nextjs-starter-buttercms.vercel.app/](https://nextjs-starter-buttercms.vercel.app/)
## Deploy your own
Once you have access to [the environment variables you'll need](#step-2-set-up-environment-variables), deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
Once you have access to your Butter API token, you can deploy your Butterized proof-of-concept app to Vercel, the creators of Next.js, and spread your love of Butter. By clicking the button below, you'll create a copy of our starter project in your Git provider account, instantly deploy it, and institute a full content workflow connected to your ButterCMS account. Smooth.
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/cms-buttercms&project-name=cms-buttercms&repository-name=cms-buttercms&env=BUTTERCMS_API_KEY,BUTTERCMS_PREVIEW_SECRET&envDescription=Required%20to%20connect%20the%20app%20with%20ButterCMS&envLink=https://vercel.link/buttercms-env)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FButterCMS%2Fnextjs-starter-buttercms&env=NEXT_PUBLIC_BUTTER_CMS_API_KEY&envDescription=Your%20ButterCMS%20API%20Token&envLink=https%3A%2F%2Fbuttercms.com%2Fsettings%2F&project-name=nextjs-starter-buttercms&repo-name=nextjs-starter-buttercms&redirect-url=https%3A%2F%2Fbuttercms.com%2Fonboarding%2Fvercel-starter-deploy-callback%2F&production-deploy-hook=Deploy%20Triggered%20from%20ButterCMS&demo-title=ButterCMS%20Next.js%20Starter&demo-description=Fully%20integrated%20with%20your%20ButterCMS%20account&demo-url=https%3A%2F%2Fnextjs-starter-buttercms.vercel.app%2F&demo-image=https://cdn.buttercms.com/r0tGK8xFRti2iRKBJ0eY&repository-name=nextjs-starter-buttercms)
### Related examples
......@@ -33,6 +37,18 @@ Once you have access to [the environment variables you'll need](#step-2-set-up-e
## How to use
### Option 1. Install via Github and NPM or Yarn
First, install the dependencies by cloning the repo and running one of the following commands, depending on your current setup:
```bash
git clone https://github.com/ButterCMS/nextjs-starter-buttercms.git
cd nextjs-starter-buttercms
npm install # or yarn install
```
### Option 2. Install via Create-Next-App
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
```bash
......@@ -49,7 +65,7 @@ pnpm create next-app -- --example cms-buttercms cms-buttercms-app
First, [create an account on ButterCMS](https://buttercms.com/).
After signing up, you’ll be presented with the API key. We’ll use this in the next step.
After signing up, you’ll be presented with your free API token. We’ll use this in the next step.
### Step 2. Set up environment variables
......@@ -61,12 +77,12 @@ cp .env.local.example .env.local
Then set each variable on `.env.local`:
- `BUTTERCMS_API_KEY` should be set as the API key.
- `BUTTERCMS_PREVIEW_SECRET` can be any random string (but avoid spaces), like `MY_SECRET` - this is used for [Preview Mode](https://nextjs.org/docs/advanced-features/preview-mode).
- `NEXT_PUBLIC_BUTTER_CMS_API_KEY` should be set as the API key.
### Step 3. Run Next.js in development mode
When you sign up to ButterCMS, it creates an example blog post automatically. You can run Next.js in development mode to view a blog containing this example post.
When you sign up for ButterCMS, it creates all of the example content used by this starter project. You can run Next.js in development mode to view your fully-functional starter project, including landing page with
API-based components, API-based menu, and a blog.
```bash
npm install
......@@ -78,44 +94,39 @@ yarn install
yarn dev
```
Your blog should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).
Your starter project should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).
### Step 4. Try preview mode
Your starter project is automatically configured to show draft changes saved in your Butter account when run locally or deploy to a hosting provider. To disable this behavior, set the following value in your `.env.local` file: `PREVIEW=false`.
To try preview mode, [create a blog post](https://buttercms.com/post/):
- Set the **Title** as `Draft Post Test`.
- Fill the content and summary with dummy text.
- Set the **Featured Image** by downloading some image from [Unsplash](https://unsplash.com/).
Most importantly, **do not publish** the blog post. Instead, click **Save Draft**.
Now, if you go to the post page on localhost, you won't see this post because it’s not published. However, if you use the **Preview Mode**, you'll be able to see the change ([Documentation](https://nextjs.org/docs/advanced-features/preview-mode)).
To enable the Preview Mode, go to this URL:
```
http://localhost:3000/api/preview?secret=<secret>&slug=draft-post-test
```
- `<secret>` should be the string you entered for `BUTTERCMS_PREVIEW_SECRET`.
If you have not already, set `PREVIEW=false` in your `.env.local` file and restart your local
development server.
You should now be able to see the draft post. To exit the preview mode, you can click **Click here to exit preview mode** at the top.
Now, if you go to the your blog list view page on localhost: [http://localhost:3000/#blog](http://localhost:3000/#blog), you won't see this post, as its status has not yet been updated to `published`. However, if you use **Preview Mode** by deleting `PREVIEW=false` from your `.env.local` file, your new post will appear ([Documentation](https://nextjs.org/docs/advanced-features/preview-mode)).
**Tip**: [You can set the preview URL on ButterCMS](https://buttercms.com/kb/preview-urls).
**Tip**: [You can set a preview URL on ButterCMS](https://buttercms.com/kb/preview-urls) for pages
deployed to Vercel, allowing you to live-preview changes on the web from within your Butter account! Sweet!
### Step 5. Deploy on Vercel
You can deploy this app to the cloud with [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
#### Deploy Your Local Project
#### Deploy from our template
To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [import to Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example).
If you want to deploy a copy of our starter to Vercel without any changes, you can just click this button:
**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 with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FButterCMS%2Fnextjs-starter-buttercms&env=NEXT_PUBLIC_BUTTER_CMS_API_KEY&envDescription=Your%20ButterCMS%20API%20Token&envLink=https%3A%2F%2Fbuttercms.com%2Fsettings%2F&project-name=nextjs-starter-buttercms&repo-name=nextjs-starter-buttercms&redirect-url=https%3A%2F%2Fbuttercms.com%2Fonboarding%2Fvercel-starter-deploy-callback%2F&production-deploy-hook=Deploy%20Triggered%20from%20ButterCMS&demo-title=ButterCMS%20Next.js%20Starter&demo-description=Fully%20integrated%20with%20your%20ButterCMS%20account&demo-url=https%3A%2F%2Fnextjs-starter-buttercms.vercel.app%2F&demo-image=https://cdn.buttercms.com/r0tGK8xFRti2iRKBJ0eY&repository-name=nextjs-starter-buttercms)
#### Deploy from Our Template
#### Deploy your local project
Alternatively, you can deploy using our template by clicking on the Deploy button below.
To deploy your local project to Vercel (one in which you've made changes), push it to GitHub/GitLab/Bitbucket and [import to Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example).
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/cms-buttercms&project-name=cms-buttercms&repository-name=cms-buttercms&env=BUTTERCMS_API_KEY,BUTTERCMS_PREVIEW_SECRET&envDescription=Required%20to%20connect%20the%20app%20with%20ButterCMS&envLink=https://vercel.link/buttercms-env)
**Important**: When you import your project on Vercel, make sure to click on **Environment Variables** and set them to match your `.env.local` file.
{
"name": "ButterCMS NextJS Starter Project ",
"description": "Drop-in proof-of-concept NextJs app, fully integrated with your ButterCMS account.",
"repository": "https://github.com/ButterCMS/nextjs-starter-buttercms",
"logo": "https://cdn.buttercms.com/R3fbtvoRT2CqEQSmk8hb",
"keywords": ["Next.js", "buttercms", "cms", "blog"],
"buildpacks": [
{
"url": "heroku/nodejs"
}
],
"env": {
"NEXT_PUBLIC_BUTTER_CMS_API_KEY": {
"description": "The API token of your ButterCMS account",
"value": ""
}
}
}
import Container from './container'
import cn from 'classnames'
import { EXAMPLE_PATH } from '@/lib/constants'
export default function Alert({ preview }) {
return (
<div
className={cn('border-b', {
'bg-accent-7 border-accent-7 text-white': preview,
'bg-accent-1 border-accent-2': !preview,
})}
>
<Container>
<div className="py-2 text-center text-sm">
{preview ? (
<>
This is page is a preview.{' '}
<a
href="/api/exit-preview"
className="underline hover:text-cyan duration-200 transition-colors"
>
Click here
</a>{' '}
to exit preview mode.
</>
) : (
<>
The source code for this blog is{' '}
<a
href={`https://github.com/vercel/next.js/tree/canary/examples/${EXAMPLE_PATH}`}
className="underline hover:text-success duration-200 transition-colors"
>
available on GitHub
</a>
.
</>
)}
</div>
</Container>
</div>
)
}
export default function AuthorCard({ author }) {
return (
<a>
{author.first_name} {author.last_name}
</a>
)
}
import Image from 'next/image'
export default function Avatar({ name, picture }) {
return (
<div className="flex items-center">
<div className="w-12 h-12 relative mr-4">
<Image
src={picture}
layout="fill"
className="rounded-full"
alt={name}
/>
</div>
<div className="text-xl font-bold">{name}</div>
</div>
)
}
import Link from 'next/link'
import PostPreviewCondensed from './post-preview-condensed'
export default function Blog({ posts }) {
return (
<section id="blog" className="blog-section">
<div className="container">
<div className="row justify-content-center">
<div className="col-lg-6 col-md-10">
<div className="section-title text-center">
<h2>Latest Blog Posts</h2>
<p>
Butter also has a built in blog engine which makes it dead
simple to launch a new company blog.
</p>
<p>
<Link href={`/blog`}>
<a className="main-btn btn-hover mt-5">View All Blog Posts</a>
</Link>
</p>
</div>
</div>
</div>
<div className="row justify-content-center">
{posts.map((post) => (
<PostPreviewCondensed
key={post.slug}
title={post.title}
coverImage={post.featuredImage}
coverImageAlt={post.featuredImageAlt}
date={post.published}
author={post.author}
slug={post.slug}
excerpt={post.summary}
/>
))}
</div>
</div>
</section>
)
}
import Link from 'next/link'
export default function CategoriesWidget({ categories }) {
return (
<div className="widget categories-widget">
<h5 className="widget-title">Categories</h5>
<ul className="categories-list">
{categories.map((category) => (
<li key={category.slug}>
<Link href={`/blog/category/${category.slug}`}>
<a>{category.name}</a>
</Link>
</li>
))}
</ul>
</div>
)
}
import Link from 'next/link'
import Image from 'next/image'
export default function PostPreviewCondensed({
title,
coverImage,
coverImageAlt,
excerpt,
slug,
}) {
return (
<div className="col-lg-4 col-md-8 col-sm-10">
<div className="single-blog">
{coverImage && (
<div className="blog-header">
<Image
src={coverImage}
alt={coverImageAlt}
layout="fill"
objectFit="cover"
/>
</div>
)}
<div className="blog-body">
<h5 className="package-name">
<Link href={`/blog/${slug}`}>
<a>{title}</a>
</Link>
</h5>
<p>{excerpt}</p>
</div>
<div className="blog-footer">
<Link href={`/blog/${slug}`}>
<a className="main-btn btn-hover">Read More</a>
</Link>
</div>
</div>
</div>
)
}
import Image from 'next/image'
import Link from 'next/link'
import HumanDate from '@/components/human-date'
import AuthorCard from '@/components/author-card'
export default function PostsPreview({
title,
coverImage,
coverImageAlt,
date,
author,
tags,
excerpt,
slug,
}) {
return (
<div className="col-12 col-lg-6">
<div className="blog-roll-card">
<div className="blog-roll-card-meta">
<h2 className="blog-roll-card-header">
<Link href={`/blog/${slug}`}>
<a>{title}</a>
</Link>
</h2>
<ul className="blog-roll-card-meta-info">
<li>
<AuthorCard author={author} />
</li>
<li>
<i className="lni lni-calendar"></i>{' '}
<HumanDate dateString={date} />
</li>
{tags.map((tag) => (
<li key={tag.slug}>
<Link href={`/blog/tag/${tag.slug}`}>
<a>
<i className="lni lni-tag"></i> {tag.name}
</a>
</Link>
</li>
))}
</ul>
</div>
{coverImage && (
<div className="single-post-thumbnail">
<Image
src={coverImage}
alt={coverImageAlt}
layout="fill"
objectFit="cover"
/>
</div>
)}
<div
className="blog-roll-card-body prose"
dangerouslySetInnerHTML={{ __html: excerpt }}
></div>
<div className="blog-roll-card-footer text-center">
<Link href={`/blog/${slug}`}>
<a className="main-btn btn-hover">Read More</a>
</Link>
</div>
</div>
</div>
)
}
import PostPreview from './post-preview'
import PostsPreview from './post-preview'
export default function MoreStories({ posts }) {
export default function PostsList({ posts }) {
return (
<section>
<h2 className="mb-8 text-6xl md:text-7xl font-bold tracking-tighter leading-tight">
More Stories
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 md:gap-x-16 lg:gap-x-32 gap-y-20 md:gap-y-32 mb-32">
<div className="col-12 col-lg-8 blog-roll-cards">
<div className="row">
{posts.map((post) => (
<PostPreview
<PostsPreview
key={post.slug}
title={post.title}
coverImage={post.featured_image}
coverImage={post.featuredImage}
date={post.published}
author={post.author}
slug={post.slug}
excerpt={post.summary}
coverImageAlt={post.featuredImageAlt}
tags={post.tags}
/>
))}
{!posts.length && <div>No blog posts found.</div>}
</div>
</section>
</div>
)
}
export default function SearchWidget() {
return (
<div className="sidebar blog-grid-page">
<div className="widget search-widget">
<h5 className="widget-title">Search This Site</h5>
<form action={`/blog/search`} method="get">
<input name="query" type="text" placeholder="Search Here..." />
<button type="submit">
<i className="lni lni-search-alt"></i>
</button>
</form>
</div>
</div>
)
}
export default function Container({ children }) {
return <div className="container mx-auto px-5">{children}</div>
}
import Image from 'next/image'
import Link from 'next/link'
import cn from 'classnames'
export default function CoverImage({ title, url, slug }) {
const image = (
<Image
width={2000}
height={1000}
alt={`Cover Image for ${title}`}
className={cn('shadow-small', {
'hover:shadow-medium transition-shadow duration-200': slug,
})}
src={url}
/>
)
return (
<div className="sm:mx-0">
{slug ? (
<Link href={`/posts/${slug}`}>
<a aria-label={title}>{image}</a>
</Link>
) : (
image
)}
</div>
)
}
import Image from 'next/image'
export default function FooterSection({ mainMenu }) {
const links = mainMenu.map((link) => ({
...link,
url: link.url[0] === '#' ? `/${link.url}` : link.url,
}))
return (
<footer className="footer pt-120">
<div className="container">
<div className="row">
<div className="col-xl-3 col-lg-4 col-md-6 col-sm-10">
<div className="footer-widget">
<div className="logo">
<a href="https://buttercms.com">
<Image
width={200}
height={50}
src="https://cdn.buttercms.com/PBral0NQGmmFzV0uG7Q6"
alt="logo"
/>
</a>
</div>
<p className="desc">
ButterCMS is your content backend. Build better with Butter.
</p>
<ul className="social-links">
<li>
<a href="#0">
<i className="lni lni-facebook"></i>
</a>
</li>
<li>
<a href="#0">
<i className="lni lni-linkedin"></i>
</a>
</li>
<li>
<a href="#0">
<i className="lni lni-instagram"></i>
</a>
</li>
<li>
<a href="#0">
<i className="lni lni-twitter"></i>
</a>
</li>
</ul>
</div>
</div>
<div className="col-xl-5 col-lg-4 col-md-12 col-sm-12 offset-xl-1">
<div className="footer-widget">
<h3>About Us</h3>
<ul className="links">
{links.map((navLink) => (
<li key={navLink.url}>
<a href={navLink.url}>{navLink.label}</a>
</li>
))}
</ul>
</div>
</div>
<div className="col-xl-3 col-lg-4 col-md-6">
<div className="footer-widget">
<h3>Subscribe Newsletter</h3>
<form action="#">
<input type="email" placeholder="Email" />
<button className="main-btn btn-hover">Subscribe</button>
</form>
</div>
</div>
</div>
</div>
</footer>
)
}
import Container from './container'
import { EXAMPLE_PATH } from '@/lib/constants'
export default function Footer() {
return (
<footer className="bg-accent-1 border-t border-accent-2">
<Container>
<div className="py-28 flex flex-col lg:flex-row items-center">
<h3 className="text-4xl lg:text-5xl font-bold tracking-tighter leading-tight text-center lg:text-left mb-10 lg:mb-0 lg:pr-4 lg:w-1/2">
Statically Generated with Next.js.
</h3>
<div className="flex flex-col lg:flex-row justify-center items-center lg:pl-4 lg:w-1/2">
<a
href="https://nextjs.org/docs/basic-features/pages"
className="mx-3 bg-black hover:bg-white hover:text-black border border-black text-white font-bold py-3 px-12 lg:px-8 duration-200 transition-colors mb-6 lg:mb-0"
>
Read Documentation
</a>
<a
href={`https://github.com/vercel/next.js/tree/canary/examples/${EXAMPLE_PATH}`}
className="mx-3 font-bold hover:underline"
>
View on GitHub
</a>
</div>
</div>
</Container>
</footer>
)
}
import { useEffect, useState, useRef } from 'react'
import Image from 'next/image'
import MainMenu from './main-menu/main-menu'
export default function HeaderSection({ mainMenu }) {
const [isNavbarSticky, setIsNavbarSticky] = useState(false)
const navbarAreaEl = useRef(null)
function fixNavBar() {
if (navbarAreaEl.current) {
setIsNavbarSticky(window.pageYOffset > navbarAreaEl.current.offsetTop)
}
}
useEffect(() => {
window.addEventListener('scroll', fixNavBar)
return () => {
window.removeEventListener('scroll', fixNavBar)
}
}, [])
return (
<header className="header">
<div
ref={navbarAreaEl}
className={`navbar-area ${isNavbarSticky ? 'sticky' : ''}`}
>
<div className="container">
<div className="row align-items-center">
<div className="col-lg-12">
<nav className="navbar navbar-expand-lg">
<a className="navbar-brand" href="https://buttercms.com">
<Image
src="https://cdn.buttercms.com/PBral0NQGmmFzV0uG7Q6"
alt="Logo"
width={180}
height={45}
/>
</a>
<MainMenu mainMenuLinks={mainMenu} />
</nav>
</div>
</div>
</div>
</div>
</header>
)
}
import Link from 'next/link'
export default function Header() {
return (
<h2 className="text-2xl md:text-4xl font-bold tracking-tight md:tracking-tighter leading-tight mb-20 mt-8">
<Link href="/">
<a className="hover:underline">Blog</a>
</Link>
.
</h2>
)
}
import Avatar from './avatar'
import Date from './date'
import CoverImage from './cover-image'
import Link from 'next/link'
export default function HeroPost({
title,
coverImage,
date,
excerpt,
author,
slug,
}) {
return (
<section>
<div className="mb-8 md:mb-16">
<CoverImage title={title} url={coverImage} slug={slug} />
</div>
<div className="md:grid md:grid-cols-2 md:gap-x-16 lg:gap-x-8 mb-20 md:mb-28">
<div>
<h3 className="mb-4 text-4xl lg:text-6xl leading-tight">
<Link href={`/posts/${slug}`}>
<a className="hover:underline">{title}</a>
</Link>
</h3>
<div className="mb-4 md:mb-0 text-lg">
<Date dateString={date} />
</div>
</div>
<div>
<p className="text-lg leading-relaxed mb-4">{excerpt}</p>
<Avatar
name={`${author.first_name} ${author.last_name}`}
picture={author.profile_image}
/>
</div>
</div>
</section>
)
}
import { parseISO, format } from 'date-fns'
export default function Date({ dateString }) {
export default function HumanDate({ dateString }) {
const date = parseISO(dateString)
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
return <time dateTime={dateString}>{format(date, 'MMM d, yyyy')}</time>
}
import { CMS_NAME, CMS_URL } from '@/lib/constants'
export default function Intro() {
return (
<section className="flex-col md:flex-row flex items-center md:justify-between mt-16 mb-16 md:mb-12">
<h1 className="text-6xl md:text-8xl font-bold tracking-tighter leading-tight md:pr-8">
Blog.
</h1>
<h4 className="text-center md:text-left text-lg mt-5 md:pl-8">
A statically generated blog example using{' '}
<a
href="https://nextjs.org/"
className="underline hover:text-success duration-200 transition-colors"
>
Next.js
</a>{' '}
and{' '}
<a
href={CMS_URL}
className="underline hover:text-success duration-200 transition-colors"
>
{CMS_NAME}
</a>
.
</h4>
</section>
)
}
import Image from 'next/image'
export default function Feature({ headline, description, icon }) {
return (
<div className="col-lg-6 col-md-6">
<div className="single-feature">
<div className="feature-icon">
{icon && <Image src={icon} layout="fill" objectFit="cover" alt="" />}
</div>
<div className="feature-content">
<h4>{headline}</h4>
<p>{description}</p>
</div>
</div>
</div>
)
}
import Feature from './feature'
export default function Features({
headline,
subheadline,
features,
scrollAnchorId,
}) {
return (
<section id={scrollAnchorId} className="feature-section">
<div className="container">
<div className="row">
<div className="col-lg-5 col-md-10">
<div className="section-title mb-60">
<h2 className="mb-20">{headline}</h2>
<p>{subheadline}</p>
</div>
</div>
<div className="col-lg-7">
<div className="row">
{features.map((feature, index) => (
<Feature
key={index}
headline={feature.headline}
description={feature.description}
icon={feature.icon}
/>
))}
</div>
</div>
</div>
</div>
</section>
)
}
import Image from 'next/image'
export default function Hero({
headline,
subheadline,
image,
buttonLabel,
buttonUrl,
scrollAnchorId,
}) {
return (
<section id={scrollAnchorId} className="hero-section">
<div className="container">
<div className="row align-items-center">
<div className="col-xl-6 col-lg-6 col-md-10">
<div className="hero-content">
<h1>{headline}</h1>
<p>{subheadline}</p>
<a href={buttonUrl} className="main-btn btn-hover">
{buttonLabel}
</a>
<a href="https://buttercms.com/join/">Need an account?</a>
</div>
</div>
{image && (
<div className="col-xxl-6 col-xl-6 col-lg-6">
<div className="hero-image text-center text-lg-end">
<Image
src={image}
layout="responsive"
height="400px"
width="400px"
alt=""
/>
</div>
</div>
)}
</div>
</div>
</section>
)
}
import dynamic from 'next/dynamic'
import camelcaseKeys from 'camelcase-keys'
import Preloader from '@/components/preloader'
import MissingSection from './missing-section'
export default function LandingPageSection({ type, sectionData }) {
const sectionsComponentPaths = () => ({
hero: dynamic(
() =>
import('@/components/landing-page-sections/hero').catch(
() => () => MissingSection
),
{
loading: Preloader,
}
),
two_column_with_image: dynamic(
() =>
import(
'@/components/landing-page-sections/two-column-with-image'
).catch(() => () => MissingSection),
{
loading: Preloader,
}
),
features: dynamic(
() =>
import('@/components/landing-page-sections/features').catch(
() => () => MissingSection
),
{
loading: Preloader,
}
),
testimonials: dynamic(
() =>
import('@/components/landing-page-sections/testimonials').catch(
() => () => MissingSection
),
{
loading: Preloader,
}
),
})
const SectionComponent = sectionsComponentPaths()[type] || MissingSection
return <SectionComponent type={type} {...camelcaseKeys(sectionData)} />
}
export default function MissingSection({ type, ...sectionData }) {
console.log(`Missing section ${type} data ${sectionData}`)
return (
<div>
<h3>Missing a template for {type}</h3>
<p>Check console for component details</p>
</div>
)
}
export default function Testimonial({ quote, name, title }) {
return (
<div className="single-testimonial">
<div className="quote">
<i className="lni lni-quotation"></i>
</div>
<div className="content">
<p>{quote}</p>
</div>
<div className="info">
<h6>{name}</h6>
<p>{title}</p>
</div>
</div>
)
}
import { useEffect } from 'react'
import { tns } from 'tiny-slider'
import Testimonial from './testimonial'
export default function Testimonials({
headline,
testimonial: testimonials,
scrollAnchorId,
}) {
useEffect(() => {
tns({
container: '.testimonial-active',
autoplay: true,
autoplayTimeout: 5000,
autoplayButtonOutput: false,
mouseDrag: true,
gutter: 0,
nav: false,
navPosition: 'bottom',
controls: true,
controlsText: [
'<i class="lni lni-chevron-left"></i>',
'<i class="lni lni-chevron-right"></i>',
],
items: 1,
})
})
return (
<section id={scrollAnchorId} className="testimonial-section mt-100">
<div className="container">
<div className="row justify-content-center">
<div className="col-xl-7 col-lg-9">
<div className="testimonial-active-wrapper">
<div className="section-title text-center">
<h2 className="mb-20">{headline}</h2>
</div>
<div className="testimonial-active">
{testimonials.map((testimonial, index) => (
<Testimonial
key={index}
quote={testimonial.quote}
name={testimonial.name}
title={testimonial.title}
/>
))}
</div>
</div>
</div>
</div>
</div>
</section>
)
}
import Image from 'next/image'
export default function TwoColumnWithImage({
headline,
subheadline,
buttonLabel,
buttonUrl,
image,
imagePosition,
scrollAnchorId,
}) {
return (
<section id={scrollAnchorId} className="cta-section">
<div className="container">
<div className="row">
{image && imagePosition === 'left' && (
<div className="col-lg-6 order-last order-lg-first">
<div className="left-image cta-image ">
<Image
src={image}
layout="responsive"
height="400px"
width="600px"
alt=""
/>
</div>
</div>
)}
<div className="col-lg-6">
<div className="cta-content-wrapper">
<div className="section-title">
<h2 className="mb-20">{headline}</h2>
<div dangerouslySetInnerHTML={{ __html: subheadline }} />
</div>
<a
href={buttonUrl}
className="main-btn btn-hover border-btn mt-30"
>
{buttonLabel}
</a>
</div>
</div>
{image && imagePosition === 'right' && (
<div className="col-lg-6">
<div className="right-image cta-image text-lg-end">
<Image
src={image}
layout="responsive"
height="400px"
width="600px"
alt=""
/>
</div>
</div>
)}
</div>
</div>
</section>
)
}
import Alert from './alert'
import Footer from './footer'
import Meta from './meta'
export default function Layout({ preview, children }) {
return (
<>
<Meta />
<div className="min-h-screen">
<Alert preview={preview} />
<main>{children}</main>
</div>
<Footer />
</>
)
}
export default function MainMenuLink({ url, label, active, callbackOnClick }) {
return (
<li className="nav-item" onClick={callbackOnClick}>
<a className={`page-scroll ${active ? 'active' : ''}`} href={`/${url}`}>
{label}
</a>
</li>
)
}
import { useEffect, useState, useRef } from 'react'
import MainMenuLink from './main-menu-link'
export default function ManiMenu({ mainMenuLinks }) {
const [activeMenuLink, setActiveMenuLink] = useState(
mainMenuLinks.length ? mainMenuLinks[0].url : ''
)
function highlightLinks() {
const sections = document.querySelectorAll('.page-scroll')
const scrollPos =
window.pageYOffset ||
document.documentElement.scrollTop ||
document.body.scrollTop
sections.forEach((currLink) => {
const val = currLink.getAttribute('href').slice(1)
if (val[0] !== '#') {
return
}
const refElement = document.querySelector(val)
if (!refElement) {
return
}
const scrollTopMinus = scrollPos + 73
if (
refElement.offsetTop <= scrollTopMinus &&
refElement.offsetTop + refElement.offsetHeight > scrollTopMinus
) {
setActiveMenuLink(val)
}
})
}
useEffect(() => {
window.addEventListener('scroll', highlightLinks)
return () => {
window.removeEventListener('scroll', highlightLinks)
}
}, [])
const [isMenuActive, setMenuActive] = useState(false)
const menuLinksEl = useRef(null)
function inactivateMenu() {
setMenuActive(false)
if (menuLinksEl.current) {
menuLinksEl.current.classList.remove('show')
}
}
return (
<>
<button
className={`navbar-toggler ${isMenuActive ? 'active' : ''}`}
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
onClick={() => setMenuActive(!isMenuActive)}
>
<span className="toggler-icon"></span>
<span className="toggler-icon"></span>
<span className="toggler-icon"></span>
</button>
<div
className="collapse navbar-collapse sub-menu-bar"
ref={menuLinksEl}
id="navbarSupportedContent"
>
<div className="ms-auto">
<ul id="nav" className="navbar-nav ms-auto">
{mainMenuLinks.map((navLink) => (
<MainMenuLink
key={navLink.url}
url={navLink.url}
label={navLink.label}
active={navLink.url === activeMenuLink}
callbackOnClick={inactivateMenu}
/>
))}
</ul>
</div>
</div>
</>
)
}
.markdown {
@apply text-lg leading-relaxed;
}
.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote {
@apply my-6;
}
.markdown h2 {
@apply text-3xl mt-12 mb-4 leading-snug;
}
.markdown h3 {
@apply text-2xl mt-8 mb-4 leading-snug;
}
import Head from 'next/head'
import { CMS_NAME, HOME_OG_IMAGE_URL } from '@/lib/constants'
export default function Meta() {
return (
<Head>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/favicon/safari-pinned-tab.svg"
color="#000000"
/>
<link rel="shortcut icon" href="/favicon/favicon.ico" />
<meta name="msapplication-TileColor" content="#000000" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="theme-color" content="#000" />
<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}.`}
/>
<meta property="og:image" content={HOME_OG_IMAGE_URL} />
</Head>
)
}
import Image from 'next/image'
export default function MissingTokenSection() {
return (
<section id="home" className="hero-section">
<div className="container">
<div className="row align-items-center">
<div className="col-xl-6 col-lg-6 col-md-10">
<div className="hero-content">
<h1>Configure your ButterCMS API Token</h1>
<p>
Please add your API token to <code>.env</code> file as{' '}
<code>NEXT_PUBLIC_BUTTER_CMS_API_KEY</code>.
</p>
<a
target="_blank"
rel="noreferrer"
href="https://buttercms.com/join/"
className="main-btn btn-hover"
>
Get your free API token
</a>
</div>
</div>
<div className="col-xxl-6 col-xl-6 col-lg-6">
<Image
width={300}
height={300}
src="https://cdn.buttercms.com/9bPtzdJ6QSWkySNjlmyR"
alt=""
/>
<div className="hero-image text-center text-lg-end"></div>
</div>
</div>
</div>
</section>
)
}
import markdownStyles from './markdown-styles.module.css'
export default function PostBody({ content }) {
return (
<div className="max-w-2xl mx-auto">
<div
className={markdownStyles['markdown']}
dangerouslySetInnerHTML={{ __html: content }}
/>
</div>
)
}
import Avatar from '../components/avatar'
import Date from '../components/date'
import CoverImage from '../components/cover-image'
import PostTitle from '../components/post-title'
export default function PostHeader({ title, coverImage, date, author }) {
return (
<>
<PostTitle>{title}</PostTitle>
<div className="hidden md:block md:mb-12">
<Avatar
name={`${author.first_name} ${author.last_name}`}
picture={author.profile_image}
/>
</div>
<div className="mb-8 md:mb-16 sm:mx-0">
<CoverImage title={title} url={coverImage} />
</div>
<div className="max-w-2xl mx-auto">
<div className="block md:hidden mb-6">
<Avatar
name={`${author.first_name} ${author.last_name}`}
picture={author.profile_image}
/>
</div>
<div className="mb-6 text-lg">
<Date dateString={date} />
</div>
</div>
</>
)
}
import Avatar from './avatar'
import Date from './date'
import CoverImage from './cover-image'
import Link from 'next/link'
export default function PostPreview({
title,
coverImage,
date,
excerpt,
author,
slug,
}) {
return (
<div>
<div className="mb-5">
<CoverImage slug={slug} title={title} url={coverImage} />
</div>
<h3 className="text-3xl mb-3 leading-snug">
<Link href={`/posts/${slug}`}>
<a className="hover:underline">{title}</a>
</Link>
</h3>
<div className="text-lg mb-4">
<Date dateString={date} />
</div>
<p className="text-lg leading-relaxed mb-4">{excerpt}</p>
<Avatar
name={`${author.first_name} ${author.last_name}`}
picture={author.profile_image}
/>
</div>
)
}
export default function PostTitle({ children }) {
return (
<h1 className="text-6xl md:text-7xl lg:text-8xl font-bold tracking-tighter leading-tight md:leading-none mb-12 text-center md:text-left">
{children}
</h1>
)
}
export default function Preloader() {
return (
<div className="preloader">
<div className="loader">
<div className="spinner">
<div className="spinner-container">
<div className="spinner-rotator">
<div className="spinner-left">
<div className="spinner-circle"></div>
</div>
<div className="spinner-right">
<div className="spinner-circle"></div>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
import { useEffect, useState } from 'react'
export default function ScrollToButtonButton() {
const [hasScrollToTopButton, setHasScrollToTopButton] = useState(false)
function toggleScrollTopButton() {
setHasScrollToTopButton(
document.body.scrollTop > 50 || document.documentElement.scrollTop > 50
)
}
useEffect(() => {
window.addEventListener('scroll', toggleScrollTopButton)
return () => {
window.removeEventListener('scroll', toggleScrollTopButton)
}
}, [])
return (
<>
{hasScrollToTopButton && (
<a href="#" className="scroll-top btn-hover">
<i className="lni lni-chevron-up"></i>
</a>
)}
</>
)
}
export default function SectionSeparator() {
return <hr className="border-accent-2 mt-28 mb-24" />
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.tns-outer {
padding: 0 !important;
}
.tns-outer [hidden] {
display: none !important;
}
.tns-outer [aria-controls],
.tns-outer [data-action] {
cursor: pointer;
}
.tns-slider {
-webkit-transition: all 0s;
-moz-transition: all 0s;
transition: all 0s;
}
.tns-slider > .tns-item {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.tns-horizontal.tns-subpixel {
white-space: nowrap;
}
.tns-horizontal.tns-subpixel > .tns-item {
display: inline-block;
vertical-align: top;
white-space: normal;
}
.tns-horizontal.tns-no-subpixel:after {
content: '';
display: table;
clear: both;
}
.tns-horizontal.tns-no-subpixel > .tns-item {
float: left;
}
.tns-horizontal.tns-carousel.tns-no-subpixel > .tns-item {
margin-right: -100%;
}
.tns-no-calc {
position: relative;
left: 0;
}
.tns-gallery {
position: relative;
left: 0;
min-height: 1px;
}
.tns-gallery > .tns-item {
position: absolute;
left: -100%;
-webkit-transition: transform 0s, opacity 0s;
-moz-transition: transform 0s, opacity 0s;
transition: transform 0s, opacity 0s;
}
.tns-gallery > .tns-slide-active {
position: relative;
left: auto !important;
}
.tns-gallery > .tns-moving {
-webkit-transition: all 0.25s;
-moz-transition: all 0.25s;
transition: all 0.25s;
}
.tns-autowidth {
display: inline-block;
}
.tns-lazy-img {
-webkit-transition: opacity 0.6s;
-moz-transition: opacity 0.6s;
transition: opacity 0.6s;
opacity: 0.6;
}
.tns-lazy-img.tns-complete {
opacity: 1;
}
.tns-ah {
-webkit-transition: height 0s;
-moz-transition: height 0s;
transition: height 0s;
}
.tns-ovh {
overflow: hidden;
}
.tns-visually-hidden {
position: absolute;
left: -10000em;
}
.tns-transparent {
opacity: 0;
visibility: hidden;
}
.tns-fadeIn {
opacity: 1;
z-index: 0;
}
.tns-fadeOut,
.tns-normal {
opacity: 0;
z-index: -1;
}
.tns-vpfix {
white-space: nowrap;
}
.tns-vpfix > div,
.tns-vpfix > li {
display: inline-block;
}
.tns-t-subp2 {
margin: 0 auto;
width: 310px;
position: relative;
height: 10px;
overflow: hidden;
}
.tns-t-ct {
width: 2333.3333333%;
width: -webkit-calc(100% * 70 / 3);
width: -moz-calc(100% * 70 / 3);
width: calc(100% * 70 / 3);
position: absolute;
right: 0;
}
.tns-t-ct:after {
content: '';
display: table;
clear: both;
}
.tns-t-ct > div {
width: 1.4285714%;
width: -webkit-calc(100% / 70);
width: -moz-calc(100% / 70);
width: calc(100% / 70);
height: 10px;
float: left;
}
......@@ -4,7 +4,7 @@
"paths": {
"@/components/*": ["components/*"],
"@/lib/*": ["lib/*"],
"@/styles/*": ["styles/*"]
"@/css/*": ["css/*"]
}
}
}
import Butter from 'buttercms'
const butter = Butter(process.env.BUTTERCMS_API_KEY)
export async function getPreviewPostBySlug(slug) {
const postResponse = await butter.post.retrieve(slug, {
preview: 1,
})
return postResponse?.data?.data
let butter
const previewSetting = process.env.PREVIEW
// make preview mode by default
const preview =
previewSetting === 'true' || previewSetting === undefined ? 1 : 0
try {
butter = Butter(process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY, preview)
} catch (e) {
console.log(e)
}
const defaultPageSize = 100
const defaultPostCount = 10
export async function getLandingPage(slug) {
try {
const page = await butter.page.retrieve('landing-page', slug)
return page?.data?.data
} catch (e) {
throw e.response.data.detail
}
}
export async function getLandingPages() {
let paginatedLandingPages = []
let currentPage = 1
while (!!currentPage) {
const landingPagesData = await getLandingPagesData(currentPage)
paginatedLandingPages.push(...landingPagesData.pages)
currentPage = landingPagesData.nextPage
}
return paginatedLandingPages
}
export async function getAllPostsWithSlug() {
// https://buttercms.com/docs/api/node?javascript#get-your-blog-posts
const response = await butter.post.list()
return response?.data?.data
async function getLandingPagesData(page, pageSize = defaultPageSize) {
try {
const params = {
page,
page_size: pageSize,
}
const response = await butter.page.list('landing-page', params)
return {
pages: response?.data?.data,
prevPage: response?.data?.meta.previous_page,
nextPage: response?.data?.meta.next_page,
}
} catch (e) {
throw e.response.data.detail
}
}
export async function getAllPostsForHome(preview) {
const response = await butter.post.list({ preview: preview ? 1 : 0 })
return response?.data?.data
export async function getPostsData(
{ page, pageSize, tag, category } = { page: 1, pageSize: defaultPostCount }
) {
try {
// https://buttercms.com/docs/api/node?javascript#get-your-blog-posts
const params = {
page_size: pageSize || defaultPostCount,
page: page || 1,
}
if (tag) {
params.tag_slug = tag
}
if (category) {
params.category_slug = category
}
const response = await butter.post.list(params)
return {
posts: response?.data?.data,
prevPage: response?.data?.meta.previous_page,
nextPage: response?.data?.meta.next_page,
}
} catch (e) {
throw e.response.data.detail
}
}
export async function getPostAndMorePosts(slug, preview) {
const postResponse = await butter.post.retrieve(slug, {
preview: preview ? 1 : 0,
})
const postListResponse = await butter.post.list()
return {
post: postResponse?.data?.data,
morePosts: postListResponse?.data?.data.filter(
({ slug: postSlug }) => postSlug !== slug
),
export async function getPost(slug) {
try {
const response = await butter.post.retrieve(slug)
return response?.data?.data
} catch (e) {
throw e.response.data.detail
}
}
export async function getMainMenu() {
try {
const response = await butter.content.retrieve(['navigation_menu'])
const mainMenu = response?.data?.data?.navigation_menu.find(
(menu) => menu.name === 'Main menu'
)
return mainMenu ? mainMenu.menu_items : []
} catch (e) {
throw e.response.data.detail
}
}
export async function getCategories() {
try {
const response = await butter.category.list()
return response?.data?.data
} catch (e) {
throw e.response.data.detail
}
}
export async function getTags() {
try {
const response = await butter.tag.list()
return response?.data?.data
} catch (e) {
throw e.response.data.detail
}
}
export async function searchPosts({ query }) {
try {
const response = await butter.post.search(query)
return response?.data?.data
} catch (e) {
throw e.response.data.detail
}
}
export const EXAMPLE_PATH = 'cms-buttercms'
export const CMS_NAME = 'ButterCMS'
export const CMS_URL = 'https://buttercms.com/'
export const HOME_OG_IMAGE_URL =
'https://og-image.vercel.app/Next.js%20Blog%20Example%20with%20**ButterCMS**.png?theme=light&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1591431148%2Fnextjs%2Fexamples%2Fbuttercms-logo.svg'
module.exports = {
reactStrictMode: true,
async rewrites() {
return [
{
source: '/',
destination: '/landing-page/landing-page-with-components',
},
]
},
redirects() {
const sourcesRequiringAuthToken = [
'/',
'/landing-page/:slug*',
'/blog/:path*',
]
return process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
? [
{
source: '/missing-token',
destination: '/',
permanent: false,
},
]
: sourcesRequiringAuthToken.map((source) => ({
source: source,
destination: '/missing-token',
permanent: false,
}))
},
images: {
domains: ['cdn.buttercms.com'],
},
}
{
"private": true,
"scripts": {
"dev": "next",
"dev": "next dev",
"build": "next build",
"start": "next start"
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"buttercms": "1.2.8",
"classnames": "2.3.1",
"date-fns": "2.28.0",
"next": "latest",
"@popperjs/core": "^2.10.2",
"acorn": "^8.0.0",
"bootstrap": "^5.1.3",
"buttercms": "^1.2.8",
"camelcase-keys": "^7.0.1",
"date-fns": "^2.25.0",
"next": "^12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react-dom": "^17.0.2",
"sharp": "^0.29.3",
"tiny-slider": "^2.9.4",
"typescript": "^3.3.1"
},
"devDependencies": {
"autoprefixer": "10.4.2",
"postcss": "8.4.5",
"tailwindcss": "^3.0.15"
"eslint": "^8.12.0",
"eslint-config-next": "^12.1.4"
}
}
import '@/styles/index.css'
import { useEffect, useState } from 'react'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
import Router from 'next/router'
import App from 'next/app'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { getMainMenu } from '@/lib/api'
import FooterSection from '@/components/footer-section'
import HeaderSection from '@/components/header-section'
import ScrollToButtonButton from '@/components/scroll-to-top-button'
import Preloader from '@/components/preloader'
import 'bootstrap/dist/css/bootstrap.css'
import '@/css/lineicons.css'
import '@/css/tiny-slider.min.css'
import '@/css/main.css'
function MyApp({ Component, pageProps, mainMenu }) {
const [isLoading, setIsLoading] = useState(false)
const router = useRouter()
const authToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
useEffect(() => {
import('bootstrap/dist/js/bootstrap.js')
const showLoader = () => {
setIsLoading(true)
}
const removeLoader = () => {
setIsLoading(false)
}
Router.events.on('routeChangeStart', showLoader)
Router.events.on('routeChangeComplete', removeLoader)
Router.events.on('routeChangeError', removeLoader)
return () => {
Router.events.off('routeChangeStart', showLoader)
Router.events.off('routeChangeComplete', removeLoader)
Router.events.off('routeChangeError', removeLoader)
}
}, [authToken, router])
const pageLayout = authToken ? (
<>
<HeaderSection mainMenu={mainMenu} />
<Component {...pageProps} />
<FooterSection mainMenu={mainMenu} />
<ScrollToButtonButton />
</>
) : (
<Component {...pageProps} />
)
return (
<>
<Head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>
Sample Landing Page with Components - powered by ButterCMS
</title>
<meta
name="description"
content="Sample Landing Page with Components - powered by ButterCMS"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="shortcut icon"
type="image/x-icon"
href="https://buttercms.com/static/v2/images/favicon.png"
/>
</Head>
{isLoading && <Preloader></Preloader>}
{!isLoading && pageLayout}
</>
)
}
MyApp.getInitialProps = async (appContext) => {
const appProps = await App.getInitialProps(appContext)
const authToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
let mainMenu = []
if (authToken) {
try {
mainMenu = await getMainMenu()
} catch (e) {
console.error("Couldn't load main menu links.", e)
}
}
return { ...appProps, mainMenu }
}
export default MyApp
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { Html, Head, Main, NextScript } from 'next/document'
export default class MyDocument extends Document {
render() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
export default function Document() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap"
rel="stylesheet"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
export default async function exit(_, res) {
// Exit the current user from "Preview Mode". This function accepts no args.
res.clearPreviewData()
// Redirect the user back to the index page.
res.writeHead(307, { Location: '/' })
res.end()
}
import { getPreviewPostBySlug } from '@/lib/api'
export default async function preview(req, res) {
// Check the secret and next parameters
// This secret should only be known to this API route and the CMS
if (
req.query.secret !== process.env.BUTTERCMS_PREVIEW_SECRET ||
!req.query.slug
) {
return res.status(401).json({ message: 'Invalid token' })
}
// Fetch the headless CMS to check if the provided `slug` exists
const post = await getPreviewPostBySlug(req.query.slug)
// If the slug doesn't exist prevent preview mode from being enabled
if (!post) {
return res.status(401).json({ message: 'Invalid slug' })
}
// Enable Preview Mode by setting the cookies
res.setPreviewData({})
// Redirect to the path from the fetched post
// We don't redirect to req.query.slug as that might lead to open redirect vulnerabilities
res.writeHead(307, { Location: `/posts/${post.slug}` })
res.end()
}
import Link from 'next/link'
import camelcaseKeys from 'camelcase-keys'
import PostsList from '@/components/blog/posts-list'
import { getPostsData, getCategories } from '@/lib/api'
import CategoriesWidget from '@/components/blog/categories-widget'
import SearchWidget from '@/components/blog/search-widget'
export default function Blog({ posts, categories }) {
return (
<>
<section id="blog-roll" className="blog-roll-nav">
<div className="container">
<div className="row justify-content-center">
<div className="col-12">
<div className="section-title text-center">
<h2>All Blog Posts</h2>
<ul className="breadcrumb-nav">
<li>
<Link href="/">
<a>Home</a>
</Link>
</li>
<li>All blog posts</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section className="blog-posts">
<div className="container">
<div className="row justify-content-center">
<PostsList posts={posts} />
<aside className="col-12 col-lg-4">
<SearchWidget />
<CategoriesWidget categories={categories} />
</aside>
</div>
</div>
</section>
</>
)
}
export async function getStaticProps() {
const butterToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
if (butterToken) {
try {
const blogPosts = (await getPostsData()).posts
const categories = await getCategories()
return { props: { posts: camelcaseKeys(blogPosts), categories } }
} catch (e) {
console.log('Could not get posts', e)
return {
props: { posts: [], categories: [] },
}
}
}
return { props: { posts: [], categories: [] } }
}
import Image from 'next/image'
import Head from 'next/head'
import Link from 'next/link'
import { useRouter } from 'next/router'
import ErrorPage from 'next/error'
import camelcaseKeys from 'camelcase-keys'
import { getPost, getPostsData, getCategories } from '@/lib/api'
import HumanDate from '@/components/human-date'
import CategoriesWidget from '@/components/blog/categories-widget'
import SearchWidget from '@/components/blog/search-widget'
import AuthorCard from '@/components/author-card'
import Preloader from '@/components/preloader'
export default function BlogPost({ post, categories }) {
const router = useRouter()
if (router.isFallback) {
return <Preloader />
}
if (!post) {
return <ErrorPage statusCode={404} />
}
return (
<>
<Head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{post.seoTitle}</title>
<meta name="description" content={post.metaDescription} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="shortcut icon"
type="image/x-icon"
href="https://buttercms.com/static/v2/images/favicon.png"
/>
<meta property="og:type" content="website" />
<meta property="og:url" content={post.url} />
<meta property="og:title" content={post.seoTitle} />
<meta property="og:image" content={post.featuredImage} />
<meta property="og:description" content={post.metaDescription} />
<meta name="twitter:site" content="@ButterCMS" />
<meta name="twitter:creator" content="@ButterCMS" />
<meta name="twitter:title" content="ButterCMS Blog" />
<meta name="twitter:description" content={post.metaDescription} />
</Head>
<section id="blog-header" className="single-post-nav">
<div className="container">
<div className="row justify-content-center">
<div className="col-12">
<div className="section-title text-center">
<h2>{post.title}</h2>
<ul className="breadcrumb-nav">
<li>
<Link href="/">
<a>Home</a>
</Link>
</li>
<li>
<Link href="/blog">
<a>Blog</a>
</Link>
</li>
<li>{post.title}</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section className="blog-post">
<div className="container">
<div className="row justify-content-center">
<div className="col-lg-8 col-md-12 col-12">
<div className="single-post">
<div className="single-post-meta">
<h2 className="single-post-header">{post.title}</h2>
<ul className="single-post-meta-info">
<li>
<AuthorCard author={post.author} />
</li>
<li>
<a>
<i className="lni lni-calendar"></i>{' '}
<HumanDate dateString={post.published} />
</a>
</li>
{post.tags.map((tag) => (
<li key={tag.slug}>
<Link href={`/blog/tag/${tag.slug}`}>
<a>
<i className="lni lni-tag"></i> {tag.name}
</a>
</Link>
</li>
))}
</ul>
</div>
{post.featuredImage && (
<div className="single-post-thumbnail">
<Image
src={post.featuredImage}
alt={post.featuredImageAlt}
layout="fill"
objectFit="cover"
/>
</div>
)}
<div
className="single-post-body prose"
dangerouslySetInnerHTML={{ __html: post.body }}
></div>
</div>
</div>
<aside className="col-12 col-lg-4">
<SearchWidget />
<CategoriesWidget categories={categories || []} />
</aside>
</div>
</div>
</section>
</>
)
}
export async function getStaticProps({ params }) {
try {
const post = await getPost(params.slug)
const categories = await getCategories()
return { props: { post: camelcaseKeys(post), categories } }
} catch (e) {
console.error(`Couldn't load post or categories data.`, e)
return {
notFound: true,
}
}
}
export async function getStaticPaths() {
const butterToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
if (butterToken) {
try {
const posts = (await getPostsData()).posts
return {
paths: posts.map((post) => `/blog/${post.slug}`),
fallback: true,
}
} catch (e) {
console.error(`Couldn't load posts.`, e)
}
}
return {
paths: [],
fallback: false,
}
}
import Link from 'next/link'
import camelcaseKeys from 'camelcase-keys'
import PostsList from '@/components/blog/posts-list'
import { getPostsData, getCategories } from '@/lib/api'
import CategoriesWidget from '@/components/blog/categories-widget'
import SearchWidget from '@/components/blog/search-widget'
export default function Category({ posts, categories, slug }) {
return (
<>
<section id="blog-roll" className="blog-roll-nav">
<div className="container">
<div className="row justify-content-center">
<div className="col-12">
<div className="section-title text-center">
<h2>Blog Posts by Category</h2>
<ul className="breadcrumb-nav">
<li>
<Link href="/">
<a>Home</a>
</Link>
</li>
<li>
<Link href="/blog">
<a>Blog</a>
</Link>
</li>
<li>Category: {slug}</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section className="blog-posts">
<div className="container">
<div className="row justify-content-center">
<PostsList posts={posts || []} />
<aside className="col-12 col-lg-4">
<SearchWidget />
<CategoriesWidget categories={categories || []} />
</aside>
</div>
</div>
</section>
</>
)
}
export async function getStaticProps({ params: { slug } }) {
try {
const blogPosts = (await getPostsData({ category: slug })).posts
const categories = await getCategories()
return {
props: { posts: camelcaseKeys(blogPosts), categories, slug },
revalidate: 1,
}
} catch (e) {
return {
notFound: true,
}
}
}
export async function getStaticPaths() {
const butterToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
if (butterToken) {
try {
const categories = await getCategories()
return {
paths: categories.map((category) => `/blog/category/${category.slug}`),
fallback: true,
}
} catch (e) {
console.error(`Couldn't load categories.`, e)
return {
paths: [],
fallback: false,
}
}
}
return {
paths: [],
fallback: false,
}
}
import Link from 'next/link'
import camelcaseKeys from 'camelcase-keys'
import PostsList from '@/components/blog/posts-list'
import { getCategories, searchPosts } from '@/lib/api'
import CategoriesWidget from '@/components/blog/categories-widget'
import SearchWidget from '@/components/blog/search-widget'
export default function Search({ posts, categories, query }) {
return (
<>
<section id="blog-roll" className="blog-roll-nav">
<div className="container">
<div className="row justify-content-center">
<div className="col-12">
<div className="section-title text-center">
<h2>Search Results</h2>
<ul className="breadcrumb-nav">
<li>
<Link href="/">
<a>Home</a>
</Link>
</li>
<li>
<Link href="/blog">
<a>Blog</a>
</Link>
</li>
<li>Search: &#34;{query}&#34;</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section className="blog-posts">
<div className="container">
<div className="row justify-content-center">
<PostsList posts={posts || []} />
<aside className="col-12 col-lg-4">
<SearchWidget />
<CategoriesWidget categories={categories || []} />
</aside>
</div>
</div>
</section>
</>
)
}
export async function getServerSideProps({ query: { query } }) {
const blogPosts = await searchPosts({ query })
const categories = await getCategories()
return {
props: { posts: camelcaseKeys(blogPosts), categories, query },
}
}
import Link from 'next/link'
import camelcaseKeys from 'camelcase-keys'
import PostsList from '@/components/blog/posts-list'
import { getPostsData, getCategories, getTags } from '@/lib/api'
import CategoriesWidget from '@/components/blog/categories-widget'
import SearchWidget from '@/components/blog/search-widget'
export default function Tag({ posts, categories, slug }) {
return (
<>
<section id="blog-roll" className="blog-roll-nav">
<div className="container">
<div className="row justify-content-center">
<div className="col-12">
<div className="section-title text-center">
<h2>Blog Posts by Tag</h2>
<ul className="breadcrumb-nav">
<li>
<Link href="/">
<a>Home</a>
</Link>
</li>
<li>
<Link href="/blog">
<a>Blog</a>
</Link>
</li>
<li>Tag: {slug}</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section className="blog-posts">
<div className="container">
<div className="row justify-content-center">
<PostsList posts={posts || []} />
<aside className="col-12 col-lg-4">
<SearchWidget />
<CategoriesWidget categories={categories || []} />
</aside>
</div>
</div>
</section>
</>
)
}
export async function getStaticProps({ params: { slug } }) {
try {
const blogPosts = (await getPostsData({ tag: slug })).posts
const categories = await getCategories()
return {
props: { posts: camelcaseKeys(blogPosts), categories, slug },
revalidate: 1,
}
} catch (e) {
return {
notFound: true,
}
}
}
export async function getStaticPaths() {
const butterToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
if (butterToken) {
try {
const tags = await getTags()
return {
paths: tags.map((tag) => `/blog/tag/${tag.slug}`),
fallback: true,
}
} catch (e) {
console.error(`Couldn't load tags.`, e)
return {
paths: [],
fallback: false,
}
}
}
return {
paths: [],
fallback: false,
}
}
import Container from '@/components/container'
import MoreStories from '@/components/more-stories'
import HeroPost from '@/components/hero-post'
import Intro from '@/components/intro'
import Layout from '@/components/layout'
import { getAllPostsForHome } from '@/lib/api'
import Head from 'next/head'
import { CMS_NAME } from '@/lib/constants'
export default function Index({ allPosts, preview }) {
const heroPost = allPosts[0]
const morePosts = allPosts.slice(1)
return (
<>
<Layout preview={preview}>
<Head>
<title>Next.js Blog Example with {CMS_NAME}</title>
</Head>
<Container>
<Intro />
{heroPost && (
<HeroPost
title={heroPost.title}
coverImage={heroPost.featured_image}
date={heroPost.published}
author={heroPost.author}
slug={heroPost.slug}
excerpt={heroPost.summary}
/>
)}
{morePosts.length > 0 && <MoreStories posts={morePosts} />}
</Container>
</Layout>
</>
)
}
export async function getStaticProps({ preview = null }) {
const allPosts = (await getAllPostsForHome(preview)) || []
return {
props: { allPosts, preview },
}
}
import Head from 'next/head'
import { useRouter } from 'next/router'
import ErrorPage from 'next/error'
import camelcaseKeys from 'camelcase-keys'
import { getLandingPage, getLandingPages, getPostsData } from '@/lib/api'
import LandingPageSection from '@/components/landing-page-sections/landing-page-section'
import Blog from '@/components/blog/blog'
import Preloader from '@/components/preloader'
export default function LandingPage({ page, blogPosts }) {
const router = useRouter()
if (router.isFallback) {
return <Preloader />
}
if (!page) {
return <ErrorPage statusCode={404} />
}
return (
<>
<Head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{page.fields.seo.title}</title>
<meta name="description" content={page.fields.seo.description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="shortcut icon"
type="image/x-icon"
href="https://buttercms.com/static/v2/images/favicon.png"
/>
</Head>
{page.fields.body.map(({ type, fields: sectionData }, index) => (
<LandingPageSection key={index} type={type} sectionData={sectionData} />
))}
<Blog posts={blogPosts} />
</>
)
}
export async function getStaticProps({ params }) {
try {
const page = await getLandingPage(params.slug)
const blogPosts = (await getPostsData({ page: 1, pageSize: 2 })).posts
return {
props: { page: camelcaseKeys(page), blogPosts: camelcaseKeys(blogPosts) },
}
} catch (e) {
console.error(`Couldn't load content for Landing page ${params.slug}.`, e)
return {
notFound: true,
}
}
}
export async function getStaticPaths() {
const butterToken = process.env.NEXT_PUBLIC_BUTTER_CMS_API_KEY
if (butterToken) {
try {
const landingPages = await getLandingPages()
return {
paths: landingPages.map((page) => `/landing-page/${page.slug}`),
fallback: true,
}
} catch (e) {
console.error("Couldn't load content for Landing pages.", e)
}
return {
paths: [],
fallback: false,
}
}
}
import MissingTokenSection from '@/components/missing-token-section'
export default function MissingToken() {
return <MissingTokenSection />
}
export async function getStaticProps() {
return {
props: {},
}
}
import { useRouter } from 'next/router'
import ErrorPage from 'next/error'
import Container from '@/components/container'
import PostBody from '@/components/post-body'
import MoreStories from '@/components/more-stories'
import Header from '@/components/header'
import PostHeader from '@/components/post-header'
import SectionSeparator from '@/components/section-separator'
import Layout from '@/components/layout'
import { getAllPostsWithSlug, getPostAndMorePosts } from '@/lib/api'
import PostTitle from '@/components/post-title'
import Head from 'next/head'
import { CMS_NAME } from '@/lib/constants'
export default function Post({ post, morePosts, preview }) {
const router = useRouter()
if (!router.isFallback && !post?.slug) {
return <ErrorPage statusCode={404} />
}
return (
<Layout preview={preview}>
<Container>
<Header />
{router.isFallback ? (
<PostTitle>Loading…</PostTitle>
) : (
<>
<article>
<Head>
<title>
{post.title} | Next.js Blog Example with {CMS_NAME}
</title>
<meta property="og:image" content={post.featured_image} />
</Head>
<PostHeader
title={post.title}
coverImage={post.featured_image}
date={post.published}
author={post.author}
/>
<PostBody content={post.body} />
</article>
<SectionSeparator />
{morePosts.length > 0 && <MoreStories posts={morePosts} />}
</>
)}
</Container>
</Layout>
)
}
export async function getStaticProps({ params, preview = null }) {
const { post, morePosts } = await getPostAndMorePosts(params.slug, preview)
return {
props: {
preview,
post,
morePosts,
},
}
}
export async function getStaticPaths() {
const allPosts = await getAllPostsWithSlug()
return {
paths: allPosts?.map((post) => `/posts/${post.slug}`) || [],
fallback: true,
}
}
// If you want to use other PostCSS plugins, see the following:
// https://tailwindcss.com/docs/using-with-preprocessors
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
<svg fill="none" height="40" viewBox="0 0 40 40" width="40" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="20" fill="#19ccda" r="20"/><path d="m12.9092 11.3252c.944 0 1.8066.1302 2.5879.3906.7812.2604 1.4404.5615 1.9775.9033v3.3448c-.5859-.3581-1.2126-.6918-1.8799-1.001-.6673-.3093-1.4241-.4639-2.2705-.4639-.4232 0-.8463.0651-1.2695.1953-.4069.1302-.7487.3256-1.0254.586-.2604.2604-.3906.594-.3906 1.0009 0 .5372.236.9441.708 1.2208.472.2766 1.0498.5533 1.7334.83l2.0019.8301c1.1394.4883 1.9776 1.0824 2.5147 1.7822.5371.6999.8056 1.4974.8056 2.3926 0 .9766-.2848 1.8392-.8544 2.5879-.5534.7324-1.3021 1.3102-2.2461 1.7334-.9278.4232-1.9613.6348-3.1006.6348-.9603 0-1.8799-.1628-2.75882-.4883-.8789-.3255-1.64388-.7243-2.29492-1.1963v-3.3447c.71615.5208 1.50553.9603 2.36816 1.3183.86268.3581 1.78228.5371 2.75878.5371.6836 0 1.2695-.1302 1.7578-.3906.4883-.2767.7324-.6836.7324-1.2207 0-.4232-.2034-.765-.6103-1.0254-.3906-.2767-.8219-.5045-1.2939-.6836l-2.5147-.9765c-1.26953-.4883-2.13216-1.1231-2.58789-1.9043-.43945-.7976-.65918-1.6765-.65918-2.6368 0-.9928.26856-1.8554.80567-2.5878.55338-.7487 1.26953-1.3265 2.1484-1.7334.8789-.4232 1.8311-.6348 2.8565-.6348zm17.7002 13.623v3.0518h-8.9112v-3.0518h2.7588v-10.2539h-2.7588v-3.0517h8.9112v3.0517h-2.7588v10.2539z" fill="#fff"/></svg>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/favicons/mstile-150x150.png"/>
<TileColor>#000000</TileColor>
</tile>
</msapplication>
</browserconfig>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1024.000000pt" height="1024.000000pt" viewBox="0 0 1024.000000 1024.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.11, written by Peter Selinger 2001-2013
</metadata>
<g transform="translate(0.000000,1024.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M4785 10234 c-22 -2 -92 -9 -155 -14 -1453 -131 -2814 -915 -3676
-2120 -480 -670 -787 -1430 -903 -2235 -41 -281 -46 -364 -46 -745 0 -381 5
-464 46 -745 278 -1921 1645 -3535 3499 -4133 332 -107 682 -180 1080 -224
155 -17 825 -17 980 0 687 76 1269 246 1843 539 88 45 105 57 93 67 -8 6 -383
509 -833 1117 l-818 1105 -1025 1517 c-564 834 -1028 1516 -1032 1516 -4 1 -8
-673 -10 -1496 -3 -1441 -4 -1499 -22 -1533 -26 -49 -46 -69 -88 -91 -32 -16
-60 -19 -211 -19 l-173 0 -46 29 c-30 19 -52 44 -67 73 l-21 45 2 2005 3 2006
31 39 c16 21 50 48 74 61 41 20 57 22 230 22 204 0 238 -8 291 -66 15 -16 570
-852 1234 -1859 664 -1007 1572 -2382 2018 -3057 l810 -1227 41 27 c363 236
747 572 1051 922 647 743 1064 1649 1204 2615 41 281 46 364 46 745 0 381 -5
464 -46 745 -278 1921 -1645 3535 -3499 4133 -327 106 -675 179 -1065 223 -96
10 -757 21 -840 13z m2094 -3094 c48 -24 87 -70 101 -118 8 -26 10 -582 8
-1835 l-3 -1798 -317 486 -318 486 0 1307 c0 845 4 1320 10 1343 16 56 51 100
99 126 41 21 56 23 213 23 148 0 174 -2 207 -20z"/>
<path d="M7843 789 c-35 -22 -46 -37 -15 -20 22 13 58 40 52 41 -3 0 -20 -10
-37 -21z"/>
<path d="M7774 744 c-18 -14 -18 -15 4 -4 12 6 22 13 22 15 0 8 -5 6 -26 -11z"/>
<path d="M7724 714 c-18 -14 -18 -15 4 -4 12 6 22 13 22 15 0 8 -5 6 -26 -11z"/>
<path d="M7674 684 c-18 -14 -18 -15 4 -4 12 6 22 13 22 15 0 8 -5 6 -26 -11z"/>
<path d="M7598 644 c-38 -20 -36 -28 2 -9 17 9 30 18 30 20 0 7 -1 6 -32 -11z"/>
</g>
</svg>
{
"name": "Next.js",
"short_name": "Next.js",
"icons": [
{
"src": "/favicons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/favicons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#000000",
"background_color": "#000000",
"display": "standalone"
}
<svg fill="none" height="701" viewBox="0 0 1440 701" width="1440" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="720.435" x2="720.435" y1="791.976" y2="42.5723"><stop offset="0" stop-color="#c2fbff"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient><path d="m.435883 649.737c486.403117-274.293 312.179117 121.413 1440.004117 0 1127.82-121.413 0-649.595215 0-649.595215h-1440.004117s-486.402883 923.887215 0 649.595215z" fill="url(#a)"/></svg>
\ No newline at end of file
<svg fill="none" height="578" viewBox="0 0 1440 578" width="1440" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a"><stop offset="0" stop-color="#c2fbff"/><stop offset="1" stop-color="#f5feff" stop-opacity=".31"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="777.675" x2="645.554" xlink:href="#a" y1="676.738" y2="-98.2904"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="777.675" x2="645.687" xlink:href="#a" y1="676.537" y2="-98.1128"/><mask id="d" height="578" maskUnits="userSpaceOnUse" width="1441" x="-1" y="0"><path d="m-.612061 334.103c0-184.436 149.514061-333.950168 333.950061-333.950168h1106.662v243.583168c0 184.436-149.51 333.95-333.95 333.95h-1106.662061z" fill="url(#c)"/></mask><path d="m-.612061 333.953c0-184.435 149.514061-333.94958203 333.950061-333.94958203h1106.662v243.88158203c0 184.436-149.51 333.95-333.95 333.95h-1106.662061z" fill="url(#b)"/><g fill="#37c2cc" mask="url(#d)"><circle cx="1302.88" cy="681.916" r="270.878"/><circle cx="1389.24" cy="603.881" opacity=".1" r="270.878"/></g></svg>
\ No newline at end of file
@tailwind base;
@tailwind components;
@tailwind utilities;
.grayscale {
filter: grayscale(1);
}
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
colors: {
'accent-1': '#FAFAFA',
'accent-2': '#EAEAEA',
'accent-7': '#333',
success: '#0070f3',
cyan: '#79FFE1',
},
spacing: {
28: '7rem',
},
letterSpacing: {
tighter: '-.04em',
},
lineHeight: {
tight: 1.2,
},
fontSize: {
'5xl': '2.5rem',
'6xl': '2.75rem',
'7xl': '4.5rem',
'8xl': '6.25rem',
},
boxShadow: {
small: '0 5px 10px rgba(0, 0, 0, 0.12)',
medium: '0 8px 30px rgba(0, 0, 0, 0.12)',
},
},
},
plugins: [],
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment