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

Use server component #19

Merged
merged 1 commit into from
Dec 31, 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
25 changes: 16 additions & 9 deletions src/app/(authentication)/login/login.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client'

import {
Alert,
Button, Col, Form, InputGroup, Row,
Alert, Button, Col, Form, FormControl, InputGroup, Row,
} from 'react-bootstrap'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faUser } from '@fortawesome/free-regular-svg-icons'
Expand All @@ -12,6 +11,7 @@ import { SyntheticEvent, useState } from 'react'
import { deleteCookie, getCookie } from 'cookies-next'
import axios from 'axios'
import Link from 'next/link'
import InputGroupText from 'react-bootstrap/InputGroupText'

export default function Login() {
const router = useRouter()
Expand Down Expand Up @@ -50,16 +50,23 @@ export default function Login() {

return (
<>
<Alert variant="danger" show={error !== ''} onClose={() => setError('')} dismissible>{error}</Alert>
<Alert
variant="danger"
show={error !== ''}
onClose={() => setError('')}
dismissible
>
{error}
</Alert>
<Form onSubmit={login}>
<InputGroup className="mb-3">
<InputGroup.Text>
<InputGroupText>
<FontAwesomeIcon
icon={faUser}
fixedWidth
/>
</InputGroup.Text>
<Form.Control
</InputGroupText>
<FormControl
name="username"
required
disabled={submitting}
Expand All @@ -70,13 +77,13 @@ export default function Login() {
</InputGroup>

<InputGroup className="mb-3">
<InputGroup.Text>
<InputGroupText>
<FontAwesomeIcon
icon={faLock}
fixedWidth
/>
</InputGroup.Text>
<Form.Control
</InputGroupText>
<FormControl
type="password"
name="password"
required
Expand Down
10 changes: 5 additions & 5 deletions src/app/(authentication)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use client'

import { Card, Col, Row } from 'react-bootstrap'
import {
Card, CardBody, Col, Row,
} from 'react-bootstrap'
import Register from '@/app/(authentication)/register/register'

export default function Page() {
return (
<Row className="justify-content-center">
<Col md={6}>
<Card className="mb-4 rounded-0">
<Card.Body className="p-4">
<CardBody className="p-4">
<h1>Register</h1>
<p className="text-black-50">Create your account</p>
<Register />
</Card.Body>
</CardBody>
</Card>
</Col>
</Row>
Expand Down
21 changes: 11 additions & 10 deletions src/app/(authentication)/register/register.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import {
Alert, Button, Form, InputGroup,
Alert, Button, Form, FormControl, InputGroup,
} from 'react-bootstrap'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faEnvelope, faUser } from '@fortawesome/free-regular-svg-icons'
Expand All @@ -10,6 +10,7 @@ import { useRouter } from 'next/navigation'
import { SyntheticEvent, useState } from 'react'
import { deleteCookie, getCookie } from 'cookies-next'
import axios from 'axios'
import InputGroupText from 'react-bootstrap/InputGroupText'

export default function Register() {
const router = useRouter()
Expand Down Expand Up @@ -51,8 +52,8 @@ export default function Register() {
<Alert variant="danger" show={error !== ''} onClose={() => setError('')} dismissible>{error}</Alert>
<Form onSubmit={register}>
<InputGroup className="mb-3">
<InputGroup.Text><FontAwesomeIcon icon={faUser} fixedWidth /></InputGroup.Text>
<Form.Control
<InputGroupText><FontAwesomeIcon icon={faUser} fixedWidth /></InputGroupText>
<FormControl
name="username"
required
disabled={submitting}
Expand All @@ -62,10 +63,10 @@ export default function Register() {
</InputGroup>

<InputGroup className="mb-3">
<InputGroup.Text>
<InputGroupText>
<FontAwesomeIcon icon={faEnvelope} fixedWidth />
</InputGroup.Text>
<Form.Control
</InputGroupText>
<FormControl
type="email"
name="email"
required
Expand All @@ -76,8 +77,8 @@ export default function Register() {
</InputGroup>

<InputGroup className="mb-3">
<InputGroup.Text><FontAwesomeIcon icon={faLock} fixedWidth /></InputGroup.Text>
<Form.Control
<InputGroupText><FontAwesomeIcon icon={faLock} fixedWidth /></InputGroupText>
<FormControl
type="password"
name="password"
required
Expand All @@ -88,8 +89,8 @@ export default function Register() {
</InputGroup>

<InputGroup className="mb-3">
<InputGroup.Text><FontAwesomeIcon icon={faLock} fixedWidth /></InputGroup.Text>
<Form.Control
<InputGroupText><FontAwesomeIcon icon={faLock} fixedWidth /></InputGroupText>
<FormControl
type="password"
name="password_repeat"
required
Expand Down
Loading