Skip to content

Commit

Permalink
[examples] Add new Tailwind CSS Prettier plugin to example (#33614)
Browse files Browse the repository at this point in the history
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

This PR adds the new official plugin for class sorting from Tailwind Labs to the Tailwind example.
Rel: https://tailwindcss.com/blog/automatic-class-sorting-with-prettier
  • Loading branch information
ecklf committed Jan 24, 2022
1 parent 562439d commit 9a2d97c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions examples/with-tailwindcss/package.json
Expand Up @@ -15,6 +15,8 @@
"@types/react": "17.0.38",
"autoprefixer": "^10.4.0",
"postcss": "^8.4.5",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.1",
"tailwindcss": "^3.0.7",
"typescript": "4.5.4"
}
Expand Down
20 changes: 10 additions & 10 deletions examples/with-tailwindcss/pages/index.tsx
Expand Up @@ -2,13 +2,13 @@ import Head from 'next/head'

export default function Home() {
return (
<div className="flex flex-col items-center justify-center min-h-screen py-2">
<div className="flex min-h-screen flex-col items-center justify-center py-2">
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<main className="flex flex-col items-center justify-center w-full flex-1 px-20 text-center">
<main className="flex w-full flex-1 flex-col items-center justify-center px-20 text-center">
<h1 className="text-6xl font-bold">
Welcome to{' '}
<a className="text-blue-600" href="https://nextjs.org">
Expand All @@ -18,15 +18,15 @@ export default function Home() {

<p className="mt-3 text-2xl">
Get started by editing{' '}
<code className="p-3 font-mono text-lg bg-gray-100 rounded-md">
<code className="rounded-md bg-gray-100 p-3 font-mono text-lg">
pages/index.tsx
</code>
</p>

<div className="flex flex-wrap items-center justify-around max-w-4xl mt-6 sm:w-full">
<div className="mt-6 flex max-w-4xl flex-wrap items-center justify-around sm:w-full">
<a
href="https://nextjs.org/docs"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Documentation &rarr;</h3>
<p className="mt-4 text-xl">
Expand All @@ -36,7 +36,7 @@ export default function Home() {

<a
href="https://nextjs.org/learn"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Learn &rarr;</h3>
<p className="mt-4 text-xl">
Expand All @@ -46,7 +46,7 @@ export default function Home() {

<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Examples &rarr;</h3>
<p className="mt-4 text-xl">
Expand All @@ -56,7 +56,7 @@ export default function Home() {

<a
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className="p-6 mt-6 text-left border w-96 rounded-xl hover:text-blue-600 focus:text-blue-600"
className="mt-6 w-96 rounded-xl border p-6 text-left hover:text-blue-600 focus:text-blue-600"
>
<h3 className="text-2xl font-bold">Deploy &rarr;</h3>
<p className="mt-4 text-xl">
Expand All @@ -66,15 +66,15 @@ export default function Home() {
</div>
</main>

<footer className="flex items-center justify-center w-full h-24 border-t">
<footer className="flex h-24 w-full items-center justify-center border-t">
<a
className="flex items-center justify-center"
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<img src="/vercel.svg" alt="Vercel Logo" className="h-4 ml-2" />
<img src="/vercel.svg" alt="Vercel Logo" className="ml-2 h-4" />
</a>
</footer>
</div>
Expand Down
7 changes: 7 additions & 0 deletions examples/with-tailwindcss/prettier.config.js
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'always',
singleQuote: true,
tabWidth: 2,
semi: false,
tailwindConfig: './tailwind.config.js',
}

0 comments on commit 9a2d97c

Please sign in to comment.