From 0f3891f330b054cff3a7dd53eb31df911188c793 Mon Sep 17 00:00:00 2001 From: Dominik Poch <dpoch@email.cz> Date: Thu, 14 Apr 2022 16:05:51 +0200 Subject: [PATCH 1/3] Moved loginProps to loginLayout LoginProps are not used outside of loginLayout and it does not make sense for it to exist outside of loginLayout. --- webapp/components/loginProps.tsx | 8 -------- webapp/layouts/loginLayout.tsx | 10 +++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) delete mode 100644 webapp/components/loginProps.tsx diff --git a/webapp/components/loginProps.tsx b/webapp/components/loginProps.tsx deleted file mode 100644 index 72f1553..0000000 --- a/webapp/components/loginProps.tsx +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Props prepared for the login form that is passed to the login layout. - */ -type LoginProps = { - children: React.ReactNode; -}; - -export default LoginProps; diff --git a/webapp/layouts/loginLayout.tsx b/webapp/layouts/loginLayout.tsx index dea3361..c62b9c6 100644 --- a/webapp/layouts/loginLayout.tsx +++ b/webapp/layouts/loginLayout.tsx @@ -1,7 +1,6 @@ import logo from '/public/usp-logo.svg'; import Image from 'next/image'; import styles from '/styles/login.module.scss'; -import LoginProps from '../components/loginProps'; import { Col, Container, Row, Stack } from 'react-bootstrap'; /** @@ -9,7 +8,7 @@ import { Col, Container, Row, Stack } from 'react-bootstrap'; * @param props Html structure of a login form. * @returns The login screen. */ -function LoginLayout(props: LoginProps) { +export function LoginLayout(props: LoginProps) { return ( <Container> <Row className="min-vh-100 align-items-center"> @@ -36,4 +35,9 @@ function LoginLayout(props: LoginProps) { ); } -export default LoginLayout; +/** + * Props prepared for the login form that is passed to the login layout. + */ +export type LoginProps = { + children: React.ReactNode; +}; -- GitLab From deed893ad8204f335bdb698a0a7e2d99627b7b04 Mon Sep 17 00:00:00 2001 From: Dominik Poch <dpoch@email.cz> Date: Thu, 14 Apr 2022 16:06:34 +0200 Subject: [PATCH 2/3] Changed a route of the login page Changed the route from /authentication/login to /login --- webapp/pages/{authentication/login.tsx => login/index.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename webapp/pages/{authentication/login.tsx => login/index.tsx} (97%) diff --git a/webapp/pages/authentication/login.tsx b/webapp/pages/login/index.tsx similarity index 97% rename from webapp/pages/authentication/login.tsx rename to webapp/pages/login/index.tsx index 340010c..ec6a70d 100644 --- a/webapp/pages/authentication/login.tsx +++ b/webapp/pages/login/index.tsx @@ -1,7 +1,7 @@ import { Form, Input, Button } from 'antd'; import { UserOutlined, LockOutlined } from '@ant-design/icons'; import 'antd/dist/antd.css'; -import LoginLayout from '../../layouts/loginLayout'; +import { LoginLayout } from '../../layouts/loginLayout'; /** * Creates a login screen. -- GitLab From 6b2ab778028e12f76561566d2c2a32399007f8bf Mon Sep 17 00:00:00 2001 From: Dominik Poch <dpoch@email.cz> Date: Thu, 14 Apr 2022 16:29:40 +0200 Subject: [PATCH 3/3] Created more generic layout props Props will be used in multiple layouts and all will have the same parameters. It does not have to be assigned specifically for the login. --- webapp/components/models/layoutProps.tsx | 8 ++++++++ webapp/layouts/loginLayout.tsx | 10 ++-------- 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 webapp/components/models/layoutProps.tsx diff --git a/webapp/components/models/layoutProps.tsx b/webapp/components/models/layoutProps.tsx new file mode 100644 index 0000000..1e9b0ba --- /dev/null +++ b/webapp/components/models/layoutProps.tsx @@ -0,0 +1,8 @@ +import React from 'react'; + +/** + * Props prepared for a react stucture that is passed to a layout. + */ +export type LayoutProps = { + children: React.ReactNode; +}; diff --git a/webapp/layouts/loginLayout.tsx b/webapp/layouts/loginLayout.tsx index c62b9c6..54d6c53 100644 --- a/webapp/layouts/loginLayout.tsx +++ b/webapp/layouts/loginLayout.tsx @@ -2,13 +2,14 @@ import logo from '/public/usp-logo.svg'; import Image from 'next/image'; import styles from '/styles/login.module.scss'; import { Col, Container, Row, Stack } from 'react-bootstrap'; +import { LayoutProps } from 'antd'; /** * Creates layout of a login screen. * @param props Html structure of a login form. * @returns The login screen. */ -export function LoginLayout(props: LoginProps) { +export function LoginLayout(props: LayoutProps) { return ( <Container> <Row className="min-vh-100 align-items-center"> @@ -34,10 +35,3 @@ export function LoginLayout(props: LoginProps) { </Container> ); } - -/** - * Props prepared for the login form that is passed to the login layout. - */ -export type LoginProps = { - children: React.ReactNode; -}; -- GitLab