generated from cp-20/nextjs-with-mantine-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
391 additions
and
842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json", | ||
"extends": ["../../biome.json"], | ||
"files": { | ||
"ignore": ["./lib.dom.d.ts", "./src/shared/lib/$path.ts"] | ||
}, | ||
"organizeImports": { | ||
"enabled": false | ||
}, | ||
"linter": { | ||
"enabled": false | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "space", | ||
"indentWidth": 2, | ||
"lineWidth": 80, | ||
"lineEnding": "lf" | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"jsxQuoteStyle": "double", | ||
"semicolons": "always", | ||
"trailingComma": "all" | ||
} | ||
}, | ||
"json": { | ||
"parser": { "allowComments": true, "allowTrailingCommas": true } | ||
}, | ||
"vcs": { | ||
"root": "../../" | ||
"clientKind": "git", | ||
"enabled": true, | ||
"root": "../../", | ||
"useIgnoreFile": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { AuthWithGoogleButton } from "@/client/Auth/_components/AuthWithGoogleButton"; | ||
import { useAutoRedirectIfLoggedIn } from "@/features/supabase/auth"; | ||
import { Stack } from "@mantine/core"; | ||
import type { FC } from "react"; | ||
import { AuthHeading } from "./_components/AuthHeading"; | ||
import { AuthLayout } from "./_components/AuthLayout"; | ||
import { AuthWithGitHubButton } from "./_components/AuthWithGitHubButton"; | ||
import { AuthWithGoogleButton } from '@/client/Auth/_components/AuthWithGoogleButton'; | ||
import { useAutoRedirectIfLoggedIn } from '@/features/supabase/auth'; | ||
import { Stack } from '@mantine/core'; | ||
import type { FC } from 'react'; | ||
import { AuthHeading } from './_components/AuthHeading'; | ||
import { AuthLayout } from './_components/AuthLayout'; | ||
import { AuthWithGitHubButton } from './_components/AuthWithGitHubButton'; | ||
|
||
export const Login: FC = () => { | ||
useAutoRedirectIfLoggedIn("/home"); | ||
useAutoRedirectIfLoggedIn('/home'); | ||
|
||
return ( | ||
<AuthLayout> | ||
<AuthHeading>ログイン</AuthHeading> | ||
<Stack spacing={16}> | ||
<AuthWithGitHubButton /> | ||
<AuthWithGoogleButton /> | ||
</Stack> | ||
</AuthLayout> | ||
); | ||
return ( | ||
<AuthLayout> | ||
<AuthHeading>ログイン</AuthHeading> | ||
<Stack spacing={16}> | ||
<AuthWithGitHubButton /> | ||
<AuthWithGoogleButton /> | ||
</Stack> | ||
</AuthLayout> | ||
); | ||
}; |
36 changes: 18 additions & 18 deletions
36
apps/web/src/client/Auth/_components/AuthWithGitHubButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { useSupabase } from "@/features/supabase/supabaseClient"; | ||
import { css } from "@emotion/react"; | ||
import { Button } from "@mantine/core"; | ||
import { IconBrandGithubFilled } from "@tabler/icons-react"; | ||
import type { FC } from "react"; | ||
import { useSupabase } from '@/features/supabase/supabaseClient'; | ||
import { css } from '@emotion/react'; | ||
import { Button } from '@mantine/core'; | ||
import { IconBrandGithubFilled } from '@tabler/icons-react'; | ||
import type { FC } from 'react'; | ||
|
||
export const AuthWithGitHubButton: FC = () => { | ||
const { loginWithGitHub } = useSupabase(); | ||
const { loginWithGitHub } = useSupabase(); | ||
|
||
return ( | ||
<Button | ||
css={css` | ||
return ( | ||
<Button | ||
css={css` | ||
background-color: black; | ||
&:hover { | ||
background-color: #222; | ||
} | ||
`} | ||
// アイコンが微妙に満足できない | ||
leftIcon={<IconBrandGithubFilled />} | ||
onClick={loginWithGitHub} | ||
type="button" | ||
variant="filled" | ||
> | ||
GitHubで認証 | ||
</Button> | ||
); | ||
// アイコンが微妙に満足できない | ||
leftIcon={<IconBrandGithubFilled />} | ||
onClick={loginWithGitHub} | ||
type="button" | ||
variant="filled" | ||
> | ||
GitHubで認証 | ||
</Button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,73 @@ | ||
import { fetcher } from "@/features/swr/fetcher"; | ||
import { GoogleTagManagerBody } from "@/shared/components/GoogleTagManager"; | ||
import "@/shared/styles/global.css"; | ||
import { MantineProvider } from "@mantine/core"; | ||
import { createPagesBrowserClient } from "@supabase/auth-helpers-nextjs"; | ||
import type { Session } from "@supabase/auth-helpers-react"; | ||
import { SessionContextProvider } from "@supabase/auth-helpers-react"; | ||
import type { AppProps } from "next/app"; | ||
import localFont from "next/font/local"; | ||
import { useMemo } from "react"; | ||
import "ress"; | ||
import { SWRConfig } from "swr"; | ||
import { fetcher } from '@/features/swr/fetcher'; | ||
import { GoogleTagManagerBody } from '@/shared/components/GoogleTagManager'; | ||
import '@/shared/styles/global.css'; | ||
import { MantineProvider } from '@mantine/core'; | ||
import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs'; | ||
import type { Session } from '@supabase/auth-helpers-react'; | ||
import { SessionContextProvider } from '@supabase/auth-helpers-react'; | ||
import type { AppProps } from 'next/app'; | ||
import localFont from 'next/font/local'; | ||
import { useMemo } from 'react'; | ||
import 'ress'; | ||
import { SWRConfig } from 'swr'; | ||
|
||
const font = localFont({ | ||
src: "./NotoSansJP-VariableFont_wght.ttf", | ||
preload: true, | ||
src: './NotoSansJP-VariableFont_wght.ttf', | ||
preload: true, | ||
}); | ||
|
||
const authCookieName = process.env.NEXT_PUBLIC_SUPABASE_AUTH_COOKIE_NAME; | ||
|
||
const MyApp = ({ | ||
Component, | ||
pageProps, | ||
Component, | ||
pageProps, | ||
}: AppProps<{ initialSession: Session }>) => { | ||
const supabaseClient = useMemo( | ||
() => | ||
createPagesBrowserClient({ | ||
cookieOptions: authCookieName | ||
? { | ||
name: authCookieName, | ||
secure: true, | ||
sameSite: "Lax", | ||
domain: "", | ||
path: "/", | ||
} | ||
: undefined, | ||
}), | ||
[], | ||
); | ||
const supabaseClient = useMemo( | ||
() => | ||
createPagesBrowserClient({ | ||
cookieOptions: authCookieName | ||
? { | ||
name: authCookieName, | ||
secure: true, | ||
sameSite: 'Lax', | ||
domain: '', | ||
path: '/', | ||
} | ||
: undefined, | ||
}), | ||
[], | ||
); | ||
|
||
return ( | ||
<> | ||
<GoogleTagManagerBody /> | ||
<MantineProvider | ||
theme={{ | ||
/** Put your mantine theme override here */ | ||
colorScheme: "light", | ||
breakpoints: { | ||
xs: "360px", | ||
sm: "540px", | ||
md: "720px", | ||
lg: "1080px", | ||
xl: "1200px", | ||
}, | ||
fontFamily: font.style.fontFamily, | ||
}} | ||
withGlobalStyles | ||
withNormalizeCSS | ||
> | ||
<SessionContextProvider | ||
initialSession={pageProps.initialSession} | ||
supabaseClient={supabaseClient} | ||
> | ||
<SWRConfig value={{ fetcher }}> | ||
<Component {...pageProps} /> | ||
</SWRConfig> | ||
</SessionContextProvider> | ||
</MantineProvider> | ||
</> | ||
); | ||
return ( | ||
<> | ||
<GoogleTagManagerBody /> | ||
<MantineProvider | ||
theme={{ | ||
/** Put your mantine theme override here */ | ||
colorScheme: 'light', | ||
breakpoints: { | ||
xs: '360px', | ||
sm: '540px', | ||
md: '720px', | ||
lg: '1080px', | ||
xl: '1200px', | ||
}, | ||
fontFamily: font.style.fontFamily, | ||
}} | ||
withGlobalStyles | ||
withNormalizeCSS | ||
> | ||
<SessionContextProvider | ||
initialSession={pageProps.initialSession} | ||
supabaseClient={supabaseClient} | ||
> | ||
<SWRConfig value={{ fetcher }}> | ||
<Component {...pageProps} /> | ||
</SWRConfig> | ||
</SessionContextProvider> | ||
</MantineProvider> | ||
</> | ||
); | ||
}; | ||
|
||
export default MyApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.