Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): implement sign-in page #23

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import type { PropsWithChildren } from 'react';

import { Flex } from '@radix-ui/themes';
import { Logo } from '@/components/logo';
import { Container, Flex } from '@radix-ui/themes';
import Link from 'next/link';

export default function AuthLayout(props: PropsWithChildren) {
return (
<Flex
direction="column"
gap="4"
mx="auto"
style={{
alignItems: 'center',
height: '100vh',
justifyContent: 'center',
}}
>
{props.children}
</Flex>
<Container size="1">
<Flex
direction="column"
gap="4"
mx="auto"
style={{
alignItems: 'start',
justifyContent: 'center',
minHeight: '80vh',
}}
>
<Link href="/" title="Go to home page">
<Logo size={64} />
</Link>

{props.children}
</Flex>
</Container>
);
}
13 changes: 13 additions & 0 deletions app/(auth)/sign-in/page.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react';

import SignInPage from './page';

const meta: Meta<typeof SignInPage> = {
component: SignInPage,
};

export const Default: StoryObj<typeof SignInPage> = {
render: () => <SignInPage />,
};

export default meta;
36 changes: 32 additions & 4 deletions app/(auth)/sign-in/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
import { Button } from '@radix-ui/themes';
import { Button, Flex, Heading, Link, Text } from '@radix-ui/themes';
import { FaSpotify } from 'react-icons/fa';

export default function Page() {
return (
<form action="/auth/sign-in" method="POST">
<Button type="submit">Sign in with Spotify</Button>
</form>
<Flex direction="column" gap="4">
<Heading>Welcome to Beecast</Heading>

<Text color="gray" size="4">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam quod
quia quibusdam quos quae.
</Text>

<form action="/auth/sign-in" method="POST">
<Flex direction="column">
<Button color="gray" highContrast size="3" type="submit">
<FaSpotify />
Continue with Spotify
</Button>
</Flex>
</form>

<Text color="gray" size="1">
By clicking continue, you acknowledge that you have read and understood,
and agree to our{' '}
<Link href="/terms-of-service" target="_blank">
Terms of Service
</Link>{' '}
and{' '}
<Link href="/privacy-policy" target="_blank">
Privacy Policy
</Link>
.
</Text>
</Flex>
);
}
24 changes: 24 additions & 0 deletions components/layout/app-header-logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Flex, Heading } from '@radix-ui/themes';
import Link from 'next/link';

import { Logo } from '../logo';

export function AppHeaderLogo() {
return (
<Flex align="center" asChild gap="2">
<Link
href="/"
style={{
color: 'inherit',
textDecoration: 'none',
}}
>
<Logo />

<Heading size="5" weight="medium">
Beecast
</Heading>
</Link>
</Flex>
);
}
33 changes: 3 additions & 30 deletions components/layout/app-header.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { ArrowRightIcon, PersonIcon } from '@radix-ui/react-icons';
import {
Avatar,
Button,
DropdownMenu,
Flex,
Heading,
Text,
} from '@radix-ui/themes';
import Image from 'next/image';
import { Avatar, Button, DropdownMenu, Flex, Text } from '@radix-ui/themes';
import Link from 'next/link';

import { AppContent } from './app-content';
import { AppHeaderLogo } from './app-header-logo';

type Props =
| {
Expand Down Expand Up @@ -83,27 +76,7 @@ export function AppHeader(props: Props) {
<Flex direction="column" gap="4" py="4">
<AppContent>
<Flex align="center" justify="between">
<Flex align="center" asChild gap="2">
<Link
href="/"
style={{
color: 'inherit',
textDecoration: 'none',
}}
>
<Image
alt="beecast logo"
height="48"
src="/logo.png"
style={{ display: 'block' }}
width="48"
/>

<Heading size="5" weight="medium">
Beecast
</Heading>
</Link>
</Flex>
<AppHeaderLogo />

{props.variant === 'authenticated' ? (
<AppHeaderActionsAuthenticated {...props} />
Expand Down
19 changes: 19 additions & 0 deletions components/logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { ComponentProps } from 'react';

import Image from 'next/image';

type Props = {
size?: ComponentProps<typeof Image>['width'];
};

export function Logo(props: Props) {
return (
<Image
alt="beecast logo"
height={props.size || 48}
src="/logo.png"
style={{ display: 'block' }}
width={props.size || 48}
/>
);
}
4 changes: 4 additions & 0 deletions components/theme-provider/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
body {
margin: 0;
}

.radix-themes {
--cursor-button: pointer;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"ofetch": "^1.3.3",
"react": "^18",
"react-dom": "^18",
"react-icons": "^4.12.0",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading