chore: remove netlify-blog temporarily

This commit is contained in:
hardfist 2024-07-24 17:35:11 +08:00
parent 308ebf1b44
commit 7adad563d1
39 changed files with 15 additions and 1246 deletions

View file

@ -1,9 +1,10 @@
module.exports = {
webpack: (config, options) => {
config.optimization.minimize = false;
config.optimization.moduleIds = 'named';
config.optimization.chunkIds = 'named';
console.log('config:',config);
return config;
},
}
// @ts-check
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: "export",
};
module.exports = nextConfig;

View file

@ -1,8 +1,8 @@
{
"private": true,
"scripts": {
"dev": "RSPACK_CONFIG_VALIDATE=loose-silent next",
"build": "cross-env RSPACK_CONFIG_VALIDATE=loose-silent NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps ../../packages/next/dist/bin/next build",
"dev": "next",
"build": "next build",
"start": "serve out"
},
"dependencies": {

View file

@ -1,37 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
# netlify
.netlify

View file

@ -1,7 +0,0 @@
module.exports = {
printWidth: 80,
semi: true,
singleQuote: true,
tabWidth: 2,
useTabs: false,
};

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 nextjs-blog-theme
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,108 +0,0 @@
![Netlify Next.js Blog Template designed by Bejamas](https://user-images.githubusercontent.com/43764894/223762618-62742b4e-9424-44a7-8e85-9f7e4e19db54.png)
[![Deploy to Netlify Button](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/netlify-templates/nextjs-blog-theme)
A customizable blog starter using:
- [Next.js](https://github.com/vercel/next.js) v14 (Pages Router)
- [Tailwind](https://tailwindcss.com/) v3.0
- Built-in [MDX](https://mdxjs.com/) v1 support
- Includes modern design with dark & light themes
![Preview of blog theme. Author named Jay Doe and blog's name is "Next.js Blog Theme" with one blog post](nextjs-blog-theme-preview.png)
[Take a gander at the demo.](https://bejamas-nextjs-blog.netlify.app)
[Click here to watch the template walkthrough!](https://www.youtube.com/watch?v=63QZHs259dY)
## Table of Contents:
- [Getting Started](#getting-started)
- [Setting Up Locally](#setting-up-locally)
- [Using the Wizard](#using-the-setup-wizard)
- [Configuring the Blog](#configuring-the-blog)
- [Adding New Posts](#adding-new-posts)
- [Testing](#testing)
- [Included Default Testing](#included-default-testing)
- [Removing Renovate](#removing-renovate)
## Getting Started
---
You can get started with this project in two ways: locally or using the [setup wizard](https://nextjs-wizard.netlify.app/).
### Setting Up Locally
If you're doing it locally, start with clicking the [use this template](https://github.com/netlify-templates/nextjs-blog-theme/generate) button on GitHub. This will create a new repository with this template's files on your GitHub account. Once that is done, clone your new repository and navigate to it in your terminal.
From there, you can install the project's dependencies by running:
```shell
yarn install
```
Finally, you can run your project locally with:
```shell
yarn run dev
```
Open your browser and visit <http://localhost:3000>, your project should be running!
### Using the Setup Wizard
![Preview of Setup Wizard showing the initial page of a setup form](nextjs-setup-wizard.png)
Through the [setup wizard](https://nextjs-wizard.netlify.app/), you can create your blog in a few clicks and deploy to Netlify.
## Configuring the blog
The config is based on environment variables to make it easy to integrate with any Jamstack platform, like Netlify.
Here are the variables you can edit:
| Variable | Description | Options
| --- | --- | --- |
| `BLOG_NAME` | the name of your blog, displayed below the avatar ||
| `BLOG_TITLE` | the main header (`h1`) on the home page ||
| `BLOG_FOOTER_TEXT`| the text in the footer ||
| `BLOG_THEME` | the theme to pass to Tailwind | default |
| `BLOG_FONT_HEADINGS` | the font-family for all HTML headings, from `h1` to `h6`| sans-serif (default), serif, monospace|
| `BLOG_FONT_PARAGRAPHS` | the font-family for all other HTML elements | sans-serif (default), serif, monospace|
All of the env variables can be configured through the [Wizard](https://nextjs-wizard.netlify.app/) or through setting the project's environment variables. You can do this in your Netlify dashaboard (Site settings/Build & deploy/Environment/Environment variables).
https://user-images.githubusercontent.com/3611928/153997545-6dcdeef0-e570-49e7-93d6-ce0d393d16c9.mp4
[alt: video walkthrough of editing env vars]
If setting an environment variable isn't your cup of tea, the defaults can be changed in [`utils/global-data.js`](/utils/global-data.js). You can also remove the variables and hard code blog information where these variables are used in the code base.
- `BLOG_THEME, BLOG_FONT_HEADINGS, & BLOG_FONT_PARAGRAPHS` are used in [`tailwind-preset.js`](tailwind-preset.js)
- `BLOG_NAME, BLOG_TITLE, BLOG_FOOTER_TEXT` are used in [`pages/index.js`](pages/index.js) & [`pages/posts/[slug].js`](pages/posts/[slug].js) through the `globalData` object.
## Adding new posts
All posts are stored in `/posts` directory. To make a new post, create a new file with the [`.mdx` extension](https://mdxjs.com/).
Since the posts are written in `MDX` format you can pass props and components. That means you can use [React components](https://reactjs.org/docs/components-and-props.html) inside your posts to make them more interactive. Learn more about how to do so in the [MDX docs on content](https://mdxjs.com/docs/using-mdx/#components).
https://user-images.githubusercontent.com/3611928/152727802-102ec296-41c8-446d-93ed-922d11187073.mp4
[alt: video walkthrough of adding a new blog post]
## Testing
### Included Default Testing
Weve included some tooling that helps us maintain these templates. This template currently uses:
- [Renovate](https://www.mend.io/free-developer-tools/renovate/) - to regularly update our dependencies
If your team is not interested in this tooling, you can remove them with ease!
### Removing Renovate
In order to keep our project up-to-date with dependencies we use a tool called [Renovate](https://github.com/marketplace/renovate). If youre not interested in this tooling, delete the `renovate.json` file and commit that onto your main branch.

View file

@ -1,20 +0,0 @@
export default function ArrowIcon({ className, color = 'text-primary' }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
className={className}
>
<path
className={`stroke-current ${color}`}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M5 12h14M12 19l7-7-7-7"
></path>
</svg>
);
}

View file

@ -1,9 +0,0 @@
import Link from 'next/link';
export default function CustomLink({ as, href, ...otherProps }) {
return <>
<Link as={as} href={href} {...otherProps}>
</Link>
</>;
}

View file

@ -1,89 +0,0 @@
const sunIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="25"
height="24"
fill="none"
viewBox="0 0 25 24"
className="dark:opacity-50"
>
<g
stroke="#fff"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
clipPath="url(#clip0_192_823)"
>
<path d="M12.5 17a5 5 0 100-10 5 5 0 000 10zM12.5 1v2M12.5 21v2M4.72 4.22l1.42 1.42M18.86 18.36l1.42 1.42M1.5 12h2M21.5 12h2M4.72 19.78l1.42-1.42M18.86 5.64l1.42-1.42"></path>
</g>
<defs>
<clipPath id="clip0_192_823">
<path
className="text-white fill-current"
d="M0 0H24V24H0z"
transform="translate(.5)"
></path>
</clipPath>
</defs>
</svg>
);
const moonIcon = (
<svg
xmlns="http://www.w3.org/2000/svg"
width="21"
height="20"
fill="none"
viewBox="0 0 21 20"
>
<path
stroke="#fff"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
className="text-gray-400 stroke-current dark:text-white"
d="M19.5 10.79A9 9 0 119.71 1a7 7 0 009.79 9.79v0z"
></path>
</svg>
);
const ThemeSwitcher = () => {
return (
<div className="flex justify-center p-1 mt-6 bg-white dark:bg-gray-900 rounded-3xl">
<button
type="button"
aria-label="Use Dark Mode"
onClick={() => {
document.documentElement.classList.add('dark');
localStorage.setItem('theme', 'dark');
}}
className="flex items-center justify-center w-24 h-10 p-2 pr-2 transition dark:bg-primary rounded-3xl align-center"
>
{moonIcon}
</button>
<button
type="button"
aria-label="Use Light Mode"
onClick={() => {
document.documentElement.classList.remove('dark');
localStorage.setItem('theme', 'light');
}}
className="flex items-center justify-center w-24 h-10 p-2 pr-2 transition bg-primary dark:bg-transparent rounded-3xl align-center"
>
{sunIcon}
</button>
</div>
);
};
export default function Footer({ copyrightText }) {
return (
<footer className="flex flex-col items-center py-16">
<p className="mb-3 font-bold uppercase dark:text-white opacity-60">
{copyrightText}
</p>
<ThemeSwitcher />
</footer>
);
}

View file

@ -1,14 +0,0 @@
import Link from 'next/link';
export default function Header({ name }) {
return (
<header className="pt-20 pb-12">
<div className="block w-12 h-12 mx-auto mb-4 rounded-full bg-gradient-conic from-gradient-3 to-gradient-4" />
<p className="text-2xl text-center dark:text-white">
<Link href="/">
{name}
</Link>
</p>
</header>
);
}

View file

@ -1,59 +0,0 @@
import classNames from 'classnames';
import { useEffect } from 'react';
import styles from './Layout.module.css';
export function GradientBackground({ variant, className }) {
const classes = classNames(
{
[styles.colorBackground]: variant === 'large',
[styles.colorBackgroundBottom]: variant === 'small',
},
className
);
return <div className={classes} />;
}
export default function Layout({ children }) {
const setAppTheme = () => {
const darkMode = localStorage.getItem('theme') === 'dark';
const lightMode = localStorage.getItem('theme') === 'light';
if (darkMode) {
document.documentElement.classList.add('dark');
} else if (lightMode) {
document.documentElement.classList.remove('dark');
}
return;
};
const handleSystemThemeChange = () => {
var darkQuery = window.matchMedia('(prefers-color-scheme: dark)');
darkQuery.onchange = (e) => {
if (e.matches) {
document.documentElement.classList.add('dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.classList.remove('dark');
localStorage.setItem('theme', 'light');
}
};
};
useEffect(() => {
setAppTheme();
}, []);
useEffect(() => {
handleSystemThemeChange();
}, []);
return (
<div className="relative pb-24 overflow-hidden">
<div className="flex flex-col items-center w-full max-w-2xl mx-auto">
{children}
</div>
</div>
);
}

View file

@ -1,46 +0,0 @@
.colorBackground {
left: 50%;
transform: translateX(-50%);
background: radial-gradient(
at 71% 77%,
var(--color-gradient-1) 0,
transparent 21%
),
radial-gradient(at 36% 47%, var(--color-gradient-3) 0, transparent 50%),
radial-gradient(at 54% 29%, var(--color-gradient-3) 0, transparent 28%),
radial-gradient(at 45% 51%, var(--color-gradient-1) 0, transparent 53%),
radial-gradient(at 73% 44%, var(--color-gradient-2) 0, transparent 54%),
radial-gradient(at 24% 7%, var(--color-gradient-2) 0, transparent 40%),
radial-gradient(at 76% 46%, var(--color-gradient-1) 0, transparent 50%);
/* mix-blend-mode: normal; */
max-height: 800px;
height: 80vh;
max-width: 1400px;
width: 70vw;
width: 100%;
filter: blur(44px);
z-index: -1;
}
.colorBackgroundBottom {
left: 50%;
transform: translateX(-50%) rotate(190deg);
background: radial-gradient(
at 83% 25%,
var(--color-gradient-1) 0,
transparent 21%
),
radial-gradient(at 36% 47%, var(--color-gradient-3) 0, transparent 50%),
radial-gradient(at 79% 45%, var(--color-gradient-3) 0, transparent 28%),
radial-gradient(at 66% 38%, var(--color-gradient-1) 0, transparent 53%),
radial-gradient(at 89% 13%, var(--color-gradient-2) 0, transparent 54%),
radial-gradient(at 24% 7%, var(--color-gradient-2) 0, transparent 40%),
radial-gradient(at 76% 46%, var(--color-gradient-1) 0, transparent 50%);
/* mix-blend-mode: normal; */
height: 600px;
max-width: 900px;
width: 55vw;
width: 100%;
filter: blur(44px);
z-index: -1;
}

View file

@ -1,11 +0,0 @@
import Head from 'next/head';
export default function SEO({ title, description }) {
return (
<Head>
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
</Head>
);
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 24 KiB

View file

@ -1,3 +0,0 @@
[build]
command = "npm run build"
publish = ".next"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

View file

@ -1,45 +0,0 @@
{
"name": "nextjs-blog-theme",
"description": "A customizable Next.js and Tailwind blog starter. Designed by the Bejamas agency.",
"author": "Bejamas and Netlify Inc.",
"contributors": [
"Charlie Gerard",
"Prince Wilson",
"Tara Manicsic",
"Thom Krupa"
],
"homepage": "https://github.com/netlify-templates/nextjs-blog-theme",
"bugs": {
"url": "https://github.com/netlify-templates/nextjs-blog-theme/issues"
},
"scripts": {
"dev": "next",
"dev:watch": "next-remote-watch ./posts",
"build": "next build",
"start": "next start",
"export": "next build && next export",
"lint": "next lint"
},
"dependencies": {
"@mapbox/rehype-prism": "^0.9.0",
"@tailwindcss/typography": "^0.5.12",
"classnames": "^2.3.1",
"gray-matter": "^4.0.3",
"next": "workspace:*",
"next-mdx-remote": "^5.0.0",
"next-remote-watch": "2.0.0",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remark-gfm": "^4.0.0"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.4",
"eslint-config-prettier": "^9.1.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4"
},
"license": "MIT"
}

View file

@ -1,5 +0,0 @@
export default function ErrorPage(){
return (
<div>404</div>
)
}

View file

@ -1,13 +0,0 @@
import '../styles/globals.css';
import 'prismjs/themes/prism-tomorrow.css';
function MyApp({ Component, pageProps }) {
return (
<>
<span className="theme-bejamas" />
<Component {...pageProps} />
</>
);
}
export default MyApp;

View file

@ -1,20 +0,0 @@
import React from 'react';
import Document, { Html, Head, Main, NextScript } from 'next/document';
class MyDocument extends Document {
render() {
return (
<Html lang="en" className="theme-compiled">
<Head />
<body
className={`antialiased text-lg bg-white dark:bg-gray-900 dark:text-white leading-base`}
>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;

View file

@ -1,23 +0,0 @@
import Link from 'next/link'
import NextError from 'next/error'
import React from 'react'
export default class Error extends React.Component {
static getInitialProps(ctx) {
const { statusCode } = NextError.getInitialProps(ctx)
return { statusCode: statusCode || null }
}
render() {
return (
<div>
<div id="errorStatusCode">{this.props.statusCode || 'unknown'}</div>
<p>
<Link href="/" id="errorGoHome">
go hoddme
</Link>
</p>
</div>
)
}
}

View file

@ -1,67 +0,0 @@
import Link from 'next/link';
import { getPosts } from '../utils/mdx-utils';
import Footer from '../components/Footer';
import Header from '../components/Header';
import Layout, { GradientBackground } from '../components/Layout';
import ArrowIcon from '../components/ArrowIcon';
import { getGlobalData } from '../utils/global-data';
import SEO from '../components/SEO';
export default function Index({ posts, globalData }) {
return (
<Layout>
<SEO title={globalData.name} description={globalData.blogTitle} />
<Header name={globalData.name} />
<main className="w-full">
<h1 className="mb-12 text-3xl text-center lg:text-5xl">
{globalData.blogTitle}
</h1>
<ul className="w-full">
{posts.map((post) => (
<li
key={post.filePath}
className="transition bg-white border border-b-0 border-gray-800 md:first:rounded-t-lg md:last:rounded-b-lg backdrop-blur-lg dark:bg-black dark:bg-opacity-30 bg-opacity-10 hover:bg-opacity-20 dark:hover:bg-opacity-50 dark:border-white border-opacity-10 dark:border-opacity-10 last:border-b hover:border-b hovered-sibling:border-t-0"
>
<Link
as={`/posts/${post.filePath.replace(/\.mdx?$/, '')}`}
href={`/posts/[slug]`}
className="block px-6 py-6 lg:py-10 lg:px-16 focus:outline-none focus:ring-4">
{post.data.date && (
<p className="mb-3 font-bold uppercase opacity-60">
{post.data.date}
</p>
)}
<h2 className="text-2xl md:text-3xl">{post.data.title}</h2>
{post.data.description && (
<p className="mt-3 text-lg opacity-60">
{post.data.description}
</p>
)}
<ArrowIcon className="mt-4" />
</Link>
</li>
))}
</ul>
</main>
<Footer copyrightText={globalData.footerText} />
<GradientBackground
variant="large"
className="fixed top-20 opacity-40 dark:opacity-60"
/>
<GradientBackground
variant="small"
className="absolute bottom-0 opacity-20 dark:opacity-10"
/>
</Layout>
);
}
export function getStaticProps() {
const posts = getPosts();
const globalData = getGlobalData();
return { props: { posts, globalData } };
}

View file

@ -1,133 +0,0 @@
import { getGlobalData } from '../../utils/global-data';
import {
getNextPostBySlug,
getPostBySlug,
getPreviousPostBySlug,
postFilePaths,
} from '../../utils/mdx-utils';
import { MDXRemote } from 'next-mdx-remote';
import Head from 'next/head';
import Link from 'next/link';
import ArrowIcon from '../../components/ArrowIcon';
import CustomLink from '../../components/CustomLink';
import Footer from '../../components/Footer';
import Header from '../../components/Header';
import Layout, { GradientBackground } from '../../components/Layout';
import SEO from '../../components/SEO';
// Custom components/renderers to pass to MDX.
// Since the MDX files aren't loaded by webpack, they have no knowledge of how
// to handle import statements. Instead, you must include components in scope
// here.
const components = {
a: CustomLink,
// It also works with dynamically-imported components, which is especially
// useful for conditionally loading components for certain routes.
// See the notes in README.md for more details.
Head,
};
export default function PostPage({
source,
frontMatter,
prevPost,
nextPost,
globalData,
}) {
return (
<Layout>
<SEO
title={`${frontMatter.title} - ${globalData.name}`}
description={frontMatter.description}
/>
<Header name={globalData.name} />
<article className="px-6 md:px-0">
<header>
<h1 className="mb-12 text-3xl text-center md:text-5xl dark:text-white">
{frontMatter.title}
</h1>
{frontMatter.description && (
<p className="mb-4 text-xl">{frontMatter.description}</p>
)}
</header>
<main>
<article className="prose dark:prose-dark">
<MDXRemote {...source} components={components} />
</article>
</main>
<div className="grid mt-12 md:grid-cols-2 lg:-mx-24">
{prevPost && (
(<Link
href={`/posts/${prevPost.slug}`}
className="flex flex-col px-10 py-8 text-center transition bg-white border border-gray-800 md:text-right first:rounded-t-lg md:first:rounded-tr-none md:first:rounded-l-lg last:rounded-r-lg first last:rounded-b-lg backdrop-blur-lg dark:bg-black dark:bg-opacity-30 bg-opacity-10 hover:bg-opacity-20 dark:hover:bg-opacity-50 dark:border-white border-opacity-10 dark:border-opacity-10 last:border-t md:border-r-0 md:last:border-r md:last:rounded-r-none">
<p className="mb-4 text-gray-500 uppercase dark:text-white dark:opacity-60">
Previous
</p>
<h4 className="mb-6 text-2xl text-gray-700 dark:text-white">
{prevPost.title}
</h4>
<ArrowIcon className="mx-auto mt-auto transform rotate-180 md:mr-0" />
</Link>)
)}
{nextPost && (
(<Link
href={`/posts/${nextPost.slug}`}
className="flex flex-col px-10 py-8 text-center transition bg-white border border-t-0 border-b-0 border-gray-800 md:text-left md:first:rounded-t-lg last:rounded-b-lg first:rounded-l-lg md:last:rounded-bl-none md:last:rounded-r-lg backdrop-blur-lg dark:bg-black dark:bg-opacity-30 bg-opacity-10 hover:bg-opacity-20 dark:hover:bg-opacity-50 dark:border-white border-opacity-10 dark:border-opacity-10 first:border-t first:rounded-t-lg md:border-t last:border-b">
<p className="mb-4 text-gray-500 uppercase dark:text-white dark:opacity-60">
Next
</p>
<h4 className="mb-6 text-2xl text-gray-700 dark:text-white">
{nextPost.title}
</h4>
<ArrowIcon className="mx-auto mt-auto md:ml-0" />
</Link>)
)}
</div>
</article>
<Footer copyrightText={globalData.footerText} />
<GradientBackground
variant="large"
className="absolute -top-32 opacity-30 dark:opacity-50"
/>
<GradientBackground
variant="small"
className="absolute bottom-0 opacity-20 dark:opacity-10"
/>
</Layout>
);
}
export const getStaticProps = async ({ params }) => {
const globalData = getGlobalData();
const { mdxSource, data } = await getPostBySlug(params.slug);
const prevPost = getPreviousPostBySlug(params.slug);
const nextPost = getNextPostBySlug(params.slug);
return {
props: {
globalData,
source: mdxSource,
frontMatter: data,
prevPost,
nextPost,
},
};
};
export const getStaticPaths = async () => {
const paths = postFilePaths
// Remove file extensions for page paths
.map((path) => path.replace(/\.mdx?$/, ''))
// Map the path into the static paths object required by Next.js
.map((slug) => ({ params: { slug } }));
return {
paths,
fallback: false,
};
};

View file

@ -1,8 +0,0 @@
// If you want to use other PostCSS plugins, see the following:
// https://tailwindcss.com/docs/using-with-preprocessors
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View file

@ -1,11 +0,0 @@
---
title: How to create SVG-ready icon symbols in Sketch PART 1
description: "Consider that for a moment: everything we see around us is assumed to have had a cause and is contingent upon."
date: May 4 2023
---
This is an example post, with a [link](https://nextjs.org) and a React component:
The title and description are pulled from the MDX file and processed using `gray-matter`. Additionally, links are rendered using a custom component passed to `next-mdx-remote`.
Go back [home](/).

View file

@ -1,121 +0,0 @@
---
title: How to create SVG-ready icon symbols in Sketch PART 2
description: "Something has always existed. According to physics, there can never be true physical nothingness—though there can be times when existence resembles nothing, such as a vacuum (the state of minimum possible energy) (Phys.org). Creating a space where there are no quantum."
date: May 8 2023
---
Something has always existed. According to physics, there can never be true physical nothingness—though there can be times when existence resembles nothing, such as a vacuum (the state of minimum possible energy) (Phys.org). Creating a space where there are no quantum fluctuations requires an enormous amount of energy, and there would be a remnant of that energy in that space afterwards if the fluctuations were flushed out, plus an unstable environment (1veritasium). Even on computers, deleted data is not actually tossed away, by rather written over.
# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
## Horizontal Rules
---
## Emphasis
**This is bold text**
**This is bold text**
_This is italic text_
_This is italic text_
~~Strikethrough~~
## Blockquotes
> Blockquotes can also be nested...
>
> > ...by using additional greater-than signs right next to each other...
> >
> > > ...or with spaces between arrows.
## Lists
Unordered
- Create a list by starting a line with `+`, `-`, or `*`
- Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
- Ac tristique libero volutpat at
* Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
- Very easy!
Ordered
1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa
4. You can use sequential numbers...
5. ...or keep all the numbers as `1.`
Start numbering with offset:
57. foo
1. bar
## Code
Inline `code`
Indented code
// Some comments
line 1 of code
line 2 of code
line 3 of code
Block code "fences"
```
Sample text here...
```
Syntax highlighting
```js
var foo = function (bar) {
return bar++;
};
console.log(foo(5));
```
## Tables
| Option | Description |
| ------ | ------------------------------------------------------------------------- |
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Right aligned columns
| Option | Description |
| -----: | ------------------------------------------------------------------------: |
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
## Links
[link text](http://dev.nodeca.com)
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)

View file

@ -1,7 +0,0 @@
---
title: Mental models for designers PART 2
description: "Consider that for a moment: everything we see around us is assumed to have had a cause and is contingent upon."
date: Jan 14 2024
---
This is an example post. There's another one [here](/posts/example-post).

View file

@ -1,7 +0,0 @@
---
title: Mental models for designers
description: "Consider that for a moment: everything we see around us is assumed to have had a cause and is contingent upon."
date: Jun 2 2023
---
This is an example post. There's another one [here](/posts/example-post).

View file

@ -1,7 +0,0 @@
---
title: Design critiques at Figma
description: "Consider that for a moment: everything we see around us is assumed to have had a cause and is contingent upon."
date: Jan 2 2023
---
This is an example post. There's another one [here](/posts/example-post).

View file

@ -1,6 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>netlify-templates/renovate-config"
]
}

View file

@ -1,17 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind variants;
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: var(--font-primary);
}
body {
font-family: var(--font-secondary);
}

View file

@ -1,9 +0,0 @@
module.exports = {
mode: 'jit',
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
],
darkMode: 'class', // or 'media' or 'class'
presets: [require('./utils/tailwind-preset')],
};

View file

@ -1,53 +0,0 @@
exports.COLOR_THEMES = {
default: {
colors: {
primary: '#7D7AFF',
'gradient-1': '#7d7aff',
'gradient-2': '#2121e2',
'gradient-3': '#00fff0',
'gradient-4': '#8785FF',
},
},
bejamas: {
colors: {
primary: '#FF8585',
'gradient-1': '#7d7aff',
'gradient-2': '#2121E2',
'gradient-3': '#FF76B8',
'gradient-4': '#001AFF',
},
},
netlify: {
colors: {
primary: '#00A354',
'gradient-1': '#00F0FF',
'gradient-2': '#00F0FF',
'gradient-3': '#FAFF00',
'gradient-4': '#00F0FF',
},
},
reddie: {
colors: {
primary: '#FF4D4D',
'gradient-1': '#FFC700',
'gradient-2': '#FF85DD',
'gradient-3': '#FF85DD',
'gradient-4': '#FF8585',
},
},
greenie: {
colors: {
primary: '#C78500',
'gradient-1': '#FFCC81',
'gradient-2': '#00F37F',
'gradient-3': '#00F37F',
'gradient-4': '#FFCC81',
},
},
};
exports.FONT_THEMES = {
'sans-serif': `ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,
serif: `ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`,
monospace: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,
};

View file

@ -1,17 +0,0 @@
export const getGlobalData = () => {
const name = process.env.BLOG_NAME
? decodeURI(process.env.BLOG_NAME)
: 'Jay Doe';
const blogTitle = process.env.BLOG_TITLE
? decodeURI(process.env.BLOG_TITLE)
: 'Next.js Blog Theme';
const footerText = process.env.BLOG_FOOTER_TEXT
? decodeURI(process.env.BLOG_FOOTER_TEXT)
: 'All rights reserved.';
return {
name,
blogTitle,
footerText,
};
};

View file

@ -1,94 +0,0 @@
import fs from 'fs';
import path from 'path';
import matter from 'gray-matter';
import { serialize } from 'next-mdx-remote/serialize';
import rehypePrism from '@mapbox/rehype-prism';
import remarkGfm from 'remark-gfm';
// POSTS_PATH is useful when you want to get the path to a specific file
export const POSTS_PATH = path.join(process.cwd(), 'posts');
// postFilePaths is the list of all mdx files inside the POSTS_PATH directory
export const postFilePaths = fs
.readdirSync(POSTS_PATH)
// Only include md(x) files
.filter((path) => /\.mdx?$/.test(path));
export const sortPostsByDate = (posts) => {
return posts.sort((a, b) => {
const aDate = new Date(a.data.date);
const bDate = new Date(b.data.date);
return bDate - aDate;
});
};
export const getPosts = () => {
let posts = postFilePaths.map((filePath) => {
const source = fs.readFileSync(path.join(POSTS_PATH, filePath));
const { content, data } = matter(source);
return {
content,
data,
filePath,
};
});
posts = sortPostsByDate(posts);
return posts;
};
export const getPostBySlug = async (slug) => {
const postFilePath = path.join(POSTS_PATH, `${slug}.mdx`);
const source = fs.readFileSync(postFilePath);
const { content, data } = matter(source);
const mdxSource = await serialize(content, {
// Optionally pass remark/rehype plugins
mdxOptions: {
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypePrism],
},
scope: data,
});
return { mdxSource, data, postFilePath };
};
export const getNextPostBySlug = (slug) => {
const posts = getPosts();
const currentFileName = `${slug}.mdx`;
const currentPost = posts.find((post) => post.filePath === currentFileName);
const currentPostIndex = posts.indexOf(currentPost);
const post = posts[currentPostIndex - 1];
// no prev post found
if (!post) return null;
const nextPostSlug = post?.filePath.replace(/\.mdx?$/, '');
return {
title: post.data.title,
slug: nextPostSlug,
};
};
export const getPreviousPostBySlug = (slug) => {
const posts = getPosts();
const currentFileName = `${slug}.mdx`;
const currentPost = posts.find((post) => post.filePath === currentFileName);
const currentPostIndex = posts.indexOf(currentPost);
const post = posts[currentPostIndex + 1];
// no prev post found
if (!post) return null;
const previousPostSlug = post?.filePath.replace(/\.mdx?$/, '');
return {
title: post.data.title,
slug: previousPostSlug,
};
};

View file

@ -1,106 +0,0 @@
const plugin = require('tailwindcss/plugin');
const pluginTypography = require('@tailwindcss/typography');
const { COLOR_THEMES, FONT_THEMES } = require('../themes');
const THEME = process.env.BLOG_THEME || 'default';
const FONT_PRIMARY = process.env.BLOG_FONT_HEADINGS || 'sans-serif';
const FONT_SECONDARY = process.env.BLOG_FONT_BODY || 'sans-serif';
const hoveredSiblingPlugin = plugin(function ({ addVariant, e }) {
addVariant('hovered-sibling', ({ container }) => {
container.walkRules((rule) => {
rule.selector = `:hover + .hovered-sibling\\:${rule.selector.slice(1)}`;
});
});
});
const themesConfig = plugin(function ({ addComponents }) {
const cssVars = {};
Object.keys(COLOR_THEMES[THEME].colors).forEach((key) => {
cssVars[`--color-${key}`] = `${COLOR_THEMES[THEME].colors[key]}`;
});
cssVars['--font-primary'] = FONT_THEMES[FONT_PRIMARY];
cssVars['--font-secondary'] = FONT_THEMES[FONT_SECONDARY];
const themeCompiled = {
'.theme-compiled': cssVars,
};
addComponents(themeCompiled);
});
module.exports = {
theme: {
extend: {
backgroundImage: {
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
colors: {
primary: 'var(--color-primary)',
'gradient-1': 'var(--color-gradient-1)',
'gradient-2': 'var(--color-gradient-2)',
'gradient-3': 'var(--color-gradient-3)',
'gradient-4': 'var(--color-gradient-4)',
},
fonts: {
primary: 'var(--font-primary)',
secondary: 'var(--font-secondary)',
},
theme: {
bejamas: {
colors: {
primary: '#FF8585',
'gradient-1': '#7d7aff',
'gradient-2': '#2121E2',
'gradient-3': '#FF76B8',
'gradient-4': '#001AFF',
},
},
},
typography(theme) {
return {
dark: {
css: {
color: theme('colors.gray.300'),
'[class~="lead"]': { color: theme('colors.gray.400') },
a: { color: theme('colors.gray.100') },
strong: { color: theme('colors.gray.100') },
'ul > li::before': { backgroundColor: theme('colors.gray.700') },
hr: { borderColor: theme('colors.gray.800') },
blockquote: {
color: theme('colors.gray.100'),
borderLeftColor: theme('colors.gray.800'),
},
h1: { color: theme('colors.gray.100') },
h2: { color: theme('colors.gray.100') },
h3: { color: theme('colors.gray.100') },
h4: { color: theme('colors.gray.100') },
code: { color: theme('colors.gray.100') },
'a code': { color: theme('colors.gray.100') },
pre: {
color: theme('colors.gray.200'),
backgroundColor: theme('colors.gray.800'),
},
thead: {
color: theme('colors.gray.100'),
borderBottomColor: theme('colors.gray.700'),
},
'tbody tr': { borderBottomColor: theme('colors.gray.800') },
},
},
};
},
},
},
variants: {
extend: {
borderRadius: ['first', 'last'],
borderWidth: ['last', 'hovered-sibling'],
typography: ['dark'],
},
},
plugins: [hoveredSiblingPlugin, pluginTypography, themesConfig],
};

View file

@ -1,16 +1,9 @@
import { useEffect } from "react";
import css from "./hello-world.module.css";
export default function HelloWorld() {
useEffect(() => {
console.log('started');
},[])
return (
<div className={css.hello}>
Hello World, I am being styled using CSS Modules!
</div>
);
}
HelloWorld.getInitialProps = (props:any) => {
return {}
}

View file

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"dev": "cross-env RSPACK_CONFIG_VALIDATE=loose-silent NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps ../../packages/next/dist/bin/next",
"dev": "next",
"build": "next build",
"start": "next start"
},
@ -14,8 +14,6 @@
"@types/node": "18.11.5",
"@types/react": "18.2.8",
"@types/react-dom": "18.0.7",
"@rsdoctor/rspack-plugin": "0.3.8",
"typescript": "4.8.4",
"webpack-stats-plugin": "1.1.3"
"typescript": "4.8.4"
}
}