Skip to content

Commit

Permalink
upd: login form (add: sample)
Browse files Browse the repository at this point in the history
  • Loading branch information
vikdiesel committed Aug 25, 2023
1 parent 167b017 commit c7a168e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ import Buttons from '../components/Buttons'
import { useRouter } from 'next/router'
import { getPageTitle } from '../config'

type LoginForm = {
login: string
password: string
remember: boolean
}

const LoginPage = () => {
const router = useRouter()

const handleSubmit = () => {
const handleSubmit = (formValues: LoginForm) => {
router.push('/dashboard')
console.log('Form values', formValues)
}

const initialValues: LoginForm = {
login: 'john.doe',
password: 'bG1sL9eQ1uD2sK3b',
remember: true,
}

return (
Expand All @@ -28,10 +41,7 @@ const LoginPage = () => {

<SectionFullScreen bg="purplePink">
<CardBox className="w-11/12 md:w-7/12 lg:w-6/12 xl:w-4/12 shadow-2xl">
<Formik
initialValues={{ login: 'john.doe', password: 'bG1sL9eQ1uD2sK3b', remember: true }}
onSubmit={() => handleSubmit()}
>
<Formik initialValues={initialValues} onSubmit={handleSubmit}>
<Form>
<FormField label="Login" help="Please enter your login">
<Field name="login" />
Expand Down

0 comments on commit c7a168e

Please sign in to comment.