-
-
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
1 parent
fe36963
commit 246f696
Showing
14 changed files
with
283 additions
and
185 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
'use client'; | ||
import React, { useState } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import { Button, Layout, Input, Form, theme } from 'antd'; | ||
import Title from 'antd/es/typography/Title'; | ||
import { request } from '@/utils'; | ||
|
||
const Auth: React.FC = () => { | ||
const [email, setEmail] = useState(''); | ||
const [submitted, setSubmitted] = useState(false); | ||
const router = useRouter(); | ||
const { | ||
token: { colorBgContainer, borderRadiusLG }, | ||
} = theme.useToken(); | ||
|
||
const onFinish = async (values: any) => { | ||
await request({ | ||
path: '/users/auth', | ||
method: 'POST', | ||
data: values, | ||
}); | ||
|
||
setEmail(values.email); | ||
setSubmitted(true); | ||
}; | ||
|
||
return ( | ||
<Layout | ||
style={{ | ||
minHeight: '100vh', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
padding: '50px', | ||
minHeight: 360, | ||
maxWidth: 550, | ||
width: '100%', | ||
marginBottom: 100, | ||
background: colorBgContainer, | ||
borderRadius: borderRadiusLG, | ||
}} | ||
> | ||
{submitted ? ( | ||
<> | ||
<Title>Check your inbox. </Title> | ||
<p style={{ marginBottom: 30 }}> | ||
Click the link we sent to {email} to sign in. | ||
</p> | ||
<Button | ||
size="large" | ||
type="primary" | ||
onClick={() => router.push('/')} | ||
> | ||
Back to Home | ||
</Button> | ||
</> | ||
) : ( | ||
<> | ||
<Title>Sign in with email</Title> | ||
<p style={{ marginBottom: 30 }}> | ||
Enter the email address and we’ll send a magic link to your inbox. | ||
</p> | ||
<Form size="large" onFinish={onFinish}> | ||
<Form.Item | ||
style={{ marginBottom: 40 }} | ||
name={'email'} | ||
rules={[ | ||
{ required: true, message: 'Email is required!' }, | ||
{ type: 'email', message: 'Email is not a valid!' }, | ||
]} | ||
> | ||
<Input placeholder="Your email" /> | ||
</Form.Item> | ||
<Button type="primary" htmlType="submit"> | ||
Continue | ||
</Button> | ||
</Form> | ||
</> | ||
)} | ||
</div> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export default Auth; |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use client'; | ||
import Script from 'next/script'; | ||
|
||
export default function Example({ | ||
lng, | ||
theme, | ||
}: { | ||
lng: string; | ||
theme: string; | ||
}) { | ||
return ( | ||
<div className="px-5"> | ||
<pre className=" overflow-auto mb-10 text-sm text-left items-center bg-gray-800 text-white rounded-md px-2 w-full"> | ||
{` | ||
<div | ||
id="zoomment" | ||
data-theme="${theme}" | ||
data-language="${lng}" | ||
data-emotions="❤️,😀,🪄,🥸,💡,🤔,💩,😢" | ||
></div> | ||
<script src='https://cdn.zoomment.com/zoomment.min.js'></script> | ||
`} | ||
</pre> | ||
|
||
<div | ||
id="zoomment" | ||
className="w-full" | ||
data-theme={theme} | ||
data-language={lng} | ||
data-emotions="❤️,😀,🪄,🥸,💡,🤔,💩,😢" | ||
></div> | ||
<Script src="https://cdn.zoomment.com/zoomment.min.js"></Script> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.