Skip to content

Commit d1fe439

Browse files
committed
add nextui
1 parent a6f86e8 commit d1fe439

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+861
-9480
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SUPABASE_PROJECT_ID=your_project_id
2+
NEXT_PUBLIC_SUPABASE_URL=https://your_project_id.supabase.co
3+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key

.eslintignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.now/*
2+
*.css
3+
.changeset
4+
dist
5+
esm/*
6+
public/*
7+
tests/*
8+
scripts/*
9+
*.config.js
10+
.DS_Store
11+
node_modules
12+
coverage
13+
.next
14+
build
15+
!.commitlintrc.cjs
16+
!.lintstagedrc.cjs
17+
!jest.config.js
18+
!plopfile.js
19+
!react-shim.js
20+
!tsup.config.ts

.eslintrc.json

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,78 @@
11
{
2-
"extends": "next/core-web-vitals",
3-
"plugins": ["prettier"],
4-
"rules": {}
2+
"$schema": "https://json.schemastore.org/eslintrc.json",
3+
"env": {
4+
"browser": false,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": ["plugin:react/recommended", "plugin:prettier/recommended", "plugin:react-hooks/recommended", "plugin:jsx-a11y/recommended"],
9+
"plugins": ["react", "unused-imports", "import", "@typescript-eslint", "jsx-a11y", "prettier"],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaFeatures": {
13+
"jsx": true
14+
},
15+
"ecmaVersion": 12,
16+
"sourceType": "module"
17+
},
18+
"settings": {
19+
"react": {
20+
"version": "detect"
21+
}
22+
},
23+
"rules": {
24+
"no-console": "off",
25+
"react/prop-types": "off",
26+
"react/jsx-uses-react": "off",
27+
"react/react-in-jsx-scope": "off",
28+
"react-hooks/exhaustive-deps": "off",
29+
"jsx-a11y/click-events-have-key-events": "warn",
30+
"jsx-a11y/interactive-supports-focus": "warn",
31+
"prettier/prettier": "warn",
32+
"no-unused-vars": "off",
33+
"unused-imports/no-unused-vars": "off",
34+
"unused-imports/no-unused-imports": "warn",
35+
"@typescript-eslint/no-unused-vars": [
36+
"warn",
37+
{
38+
"args": "after-used",
39+
"ignoreRestSiblings": false,
40+
"argsIgnorePattern": "^_.*?$"
41+
}
42+
],
43+
"import/order": [
44+
"warn",
45+
{
46+
"groups": ["type", "builtin", "object", "external", "internal", "parent", "sibling", "index"],
47+
"pathGroups": [
48+
{
49+
"pattern": "~/**",
50+
"group": "external",
51+
"position": "after"
52+
}
53+
],
54+
"newlines-between": "always"
55+
}
56+
],
57+
"react/self-closing-comp": "warn",
58+
"react/jsx-sort-props": [
59+
"warn",
60+
{
61+
"callbacksLast": true,
62+
"shorthandFirst": true,
63+
"noSortAlphabetically": false,
64+
"reservedFirst": true
65+
}
66+
],
67+
"padding-line-between-statements": [
68+
"warn",
69+
{ "blankLine": "always", "prev": "*", "next": "return" },
70+
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
71+
{
72+
"blankLine": "any",
73+
"prev": ["const", "let", "var"],
74+
"next": ["const", "let", "var"]
75+
}
76+
]
77+
}
578
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7-
.yarn/install-state.gz
87

98
# testing
109
/coverage

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.prettierrc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,5 @@
99
"bracketSpacing": true,
1010
"endOfLine": "lf",
1111
"jsxSingleQuote": false,
12-
"plugins": ["prettier-plugin-tailwindcss", "@trivago/prettier-plugin-sort-imports"],
13-
"importOrder": ["(^react|react|next)", "<THIRD_PARTY_MODULES>", "@/components", "@/(lib|utils)", "@/types", "^[./]"],
14-
"importOrderSeparation": false,
15-
"importOrderGroupNamespaceSpecifiers": true,
16-
"importOrderSortSpecifiers": true
12+
"plugins": ["prettier-plugin-tailwindcss"]
1713
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Next UI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,53 @@
1-
# Test supabase
1+
# Next.js & NextUI Template with Supabase
22

3-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
3+
This is a template for creating applications using Next.js 14 (app directory) and NextUI (v2).
44

5-
## Getting Started
5+
[Try it on CodeSandbox](https://githubbox.com/nextui-org/next-app-template)
66

7-
First, run the development server:
7+
## Technologies Used
8+
9+
- [Next.js 14](https://nextjs.org/docs/getting-started)
10+
- [NextUI v2](https://nextui.org/)
11+
- [Tailwind CSS](https://tailwindcss.com/)
12+
- [Tailwind Variants](https://tailwind-variants.org)
13+
- [TypeScript](https://www.typescriptlang.org/)
14+
- [Framer Motion](https://www.framer.com/motion/)
15+
- [next-themes](https://github.com/pacocoursey/next-themes)
16+
17+
## How to Use
18+
19+
### Use the template with create-next-app
20+
21+
To create a new project based on this template using `create-next-app`, run the following command:
822

923
```bash
10-
npm run dev
11-
# or
12-
yarn dev
13-
# or
14-
pnpm dev
15-
# or
16-
bun dev
24+
npx create-next-app -e https://github.com/nextui-org/next-app-template
1725
```
1826

19-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
27+
### Install dependencies
2028

21-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
29+
You can use one of them `npm`, `yarn`, `pnpm`, `bun`, Example using `npm`:
2230

23-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
31+
```bash
32+
npm install
33+
```
2434

25-
## Learn More
35+
### Run the development server
2636

27-
To learn more about Next.js, take a look at the following resources:
37+
```bash
38+
npm run dev
39+
```
2840

29-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
30-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
41+
### Setup pnpm (optional)
3142

32-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
43+
If you are using `pnpm`, you need to add the following code to your `.npmrc` file:
44+
45+
```bash
46+
public-hoist-pattern[]=*@nextui-org/*
47+
```
3348

34-
## Deploy on Vercel
49+
After modifying the `.npmrc` file, you need to run `pnpm install` again to ensure that the dependencies are installed correctly.
3550

36-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
51+
## License
3752

38-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
53+
Licensed under the [MIT license](https://github.com/nextui-org/next-app-template/blob/main/LICENSE).

app/auth/callback/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NextResponse } from 'next/server';
2+
23
import { createClient } from '@/lib/supabase/server';
34

45
export async function GET(request: Request) {
@@ -10,6 +11,7 @@ export async function GET(request: Request) {
1011
if (code) {
1112
const supabase = await createClient();
1213
const { error } = await supabase.auth.exchangeCodeForSession(code);
14+
1315
if (!error) {
1416
return NextResponse.redirect(`${origin}${next}`);
1517
}

app/auth/confirm/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { type NextRequest, NextResponse } from 'next/server';
22
import { type EmailOtpType } from '@supabase/supabase-js';
3+
34
import { createClient } from '@/lib/supabase/server';
45

56
/**
@@ -14,6 +15,7 @@ export async function GET(request: NextRequest) {
1415
const next = searchParams.get('next') ?? '/';
1516

1617
const redirectTo = request.nextUrl.clone();
18+
1719
redirectTo.pathname = next;
1820
redirectTo.searchParams.delete('token_hash');
1921
redirectTo.searchParams.delete('type');
@@ -25,13 +27,16 @@ export async function GET(request: NextRequest) {
2527
type,
2628
token_hash,
2729
});
30+
2831
if (!error) {
2932
redirectTo.searchParams.delete('next');
33+
3034
return NextResponse.redirect(redirectTo);
3135
}
3236
}
3337

3438
// return the user to an error page with some instructions
3539
redirectTo.pathname = '/error';
40+
3641
return NextResponse.redirect(redirectTo);
3742
}

app/blog/layout.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function BlogLayout({ children }: { children: React.ReactNode }) {
2+
return (
3+
<section className="flex flex-col items-center justify-center gap-4 py-8 md:py-10">
4+
<div className="inline-block max-w-lg justify-center text-center">{children}</div>
5+
</section>
6+
);
7+
}

app/blog/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { title } from '@/components/primitives';
2+
3+
export default function BlogPage() {
4+
return (
5+
<div>
6+
<h1 className={title()}>Blog</h1>
7+
</div>
8+
);
9+
}

app/error.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client';
2+
3+
import { useEffect } from 'react';
4+
5+
export default function Error({ error, reset }: { error: Error; reset: () => void }) {
6+
useEffect(() => {
7+
// Log the error to an error reporting service
8+
/* eslint-disable no-console */
9+
console.error(error);
10+
}, [error]);
11+
12+
return (
13+
<div>
14+
<h2>Something went wrong!</h2>
15+
<button
16+
onClick={
17+
// Attempt to recover by trying to re-render the segment
18+
() => reset()
19+
}
20+
>
21+
Try again
22+
</button>
23+
</div>
24+
);
25+
}

app/layout.tsx

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
1-
import { Providers } from '@/app/providers';
2-
import { DEFAULT_URL } from '@/const';
3-
import { GeistSans } from 'geist/font/sans';
1+
import clsx from 'clsx';
2+
import { Metadata, Viewport } from 'next';
3+
44
import { Footer } from '@/components/layout/Footer';
5-
import { Header } from '@/components/layout/header';
6-
// Styles
7-
import './styles/globals.css';
5+
import { Header } from '@/components/layout/Header';
6+
import { Providers } from '@/app/providers';
7+
import { fontSans } from '@/config/fonts';
8+
import { siteConfig } from '@/config/site';
89

9-
export const metadata = {
10-
metadataBase: new URL(DEFAULT_URL),
11-
title: 'Next.js and Supabase Starter Kit',
12-
description: 'The fastest way to build apps with Next.js and Supabase',
10+
import '@/styles/globals.css';
11+
12+
export const metadata: Metadata = {
13+
title: {
14+
default: siteConfig.name,
15+
template: `%s - ${siteConfig.name}`,
16+
},
17+
description: siteConfig.description,
18+
icons: {
19+
icon: '/favicon.ico',
20+
},
1321
};
1422

15-
const RootLayout: FC = ({ children }) => {
16-
return (
17-
<html lang="en" className={GeistSans.className} suppressHydrationWarning>
18-
<body>
19-
<main className="min-h-screen flex flex-col items-center">
20-
<Providers>
21-
<Header />
22-
<div className="flex-1 w-full">{children}</div>
23-
<Footer />
24-
</Providers>
25-
</main>
26-
</body>
27-
</html>
28-
);
23+
export const viewport: Viewport = {
24+
themeColor: [
25+
{ media: '(prefers-color-scheme: light)', color: 'white' },
26+
{ media: '(prefers-color-scheme: dark)', color: 'black' },
27+
],
2928
};
3029

30+
const RootLayout: FC = ({ children }) => (
31+
<html suppressHydrationWarning lang="en">
32+
<body className={clsx('min-h-screen bg-background font-sans antialiased', fontSans.variable)}>
33+
<Providers attribute="class" defaultTheme="dark">
34+
<div className="relative flex h-screen flex-col">
35+
<Header />
36+
<main className="container mx-auto max-w-7xl flex-grow px-6 pt-16">{children}</main>
37+
<Footer />
38+
</div>
39+
</Providers>
40+
</body>
41+
</html>
42+
);
43+
3144
export default RootLayout;

0 commit comments

Comments
 (0)