Skip to content

Commit

Permalink
DOKY-194 Create component for Logo (#127)
Browse files Browse the repository at this point in the history
Refactor logo component usage across pages

Replace hardcoded logo references with the newly created reusable `Logo` component in multiple pages. This improves maintainability and consistency of the logo display throughout the application.
  • Loading branch information
hanna-eismant authored Dec 10, 2024
1 parent 329361b commit d00f4e8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app-server/doky-front/src/components/Logo/Logo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React, {memo} from 'react';

const Logo = () => <img className='mb-3 mt-3 img-fluid' alt="Logo" src='/logo-color-bg.svg'/>;

export default memo(Logo);
3 changes: 3 additions & 0 deletions app-server/doky-front/src/components/Logo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Logo from './Logo.jsx';

export default Logo;
3 changes: 2 additions & 1 deletion app-server/doky-front/src/pages/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {FormInput} from '../../components';
import AlertError from '../../components/AlertError.jsx';
import {useLogin} from './useLogin.js';
import {useForm} from '../../hooks/useForm.js';
import Logo from '../../components/Logo/Logo.jsx';

const initialFormData = {
uid: '',
Expand All @@ -27,7 +28,7 @@ const Login = () => {
{globalError ? <AlertError message={globalError}/> : ''}
<div className='d-flex align-items-center justify-content-center'>
<form onSubmit={handleSubmit} className='col-3'>
<img className='mb-3 mt-3 img-fluid' src='/logo-color-bg.svg'/>
<Logo/>
<FormInput id='uid' label='Email' type='text' value={data.uid} onChange={uid.setValue}
errors={uid.errors}/>
<FormInput id='password' label='Password' type='password' value={data.password} onChange={password.setValue}
Expand Down
3 changes: 2 additions & 1 deletion app-server/doky-front/src/pages/Register/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {useRegister} from './useRegister.js';
import {useForm} from '../../hooks/useForm.js';
import {FormInput} from '../../components';
import AlertError from '../../components/AlertError.jsx';
import Logo from '../../components/Logo/Logo.jsx';

const initialFormData = {
uid: '',
Expand All @@ -29,7 +30,7 @@ const Register = () => {
{globalError ? <AlertError message={globalError}/> : ''}
<div className="d-flex align-items-center justify-content-center">
<form onSubmit={handleSubmit} className="col-3">
<img className="mb-3 mt-3 img-fluid" src="/logo-color-bg.svg"/>
<Logo/>
<FormInput id="uid" label="Email" type="text" value={data.uid} onChange={uid.setValue}
errors={uid.errors}/>
<FormInput id="password" label="Password" type="password" value={data.password} onChange={password.setValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Link} from 'react-router-dom';
import React, {useState} from 'react';
import {useForm} from '../../hooks/useForm.js';
import {useRequestResetPassword} from './useRequestResetPassword.js';
import Logo from '../../components/Logo/Logo.jsx';

const initialFormData = {
email: ''
Expand All @@ -30,7 +31,7 @@ const ResetPassword = () => {
{globalError ? <AlertError message={globalError}/> : ''}
<div className='d-flex align-items-center justify-content-center'>
<div className='col-3'>
<img alt='doky logo' className='mb-3 mt-3 img-fluid' src='/logo-color-bg.svg'/>
<Logo/>

{isSent && !globalError ? (
<div className='mt-3 row text-center'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Link, useNavigate, useSearchParams} from 'react-router-dom';
import React from 'react';
import {useForm} from '../../hooks/useForm.js';
import {useUpdatePassword} from './useUpdatePassword.js';
import Logo from '../../components/Logo/Logo.jsx';

const initialFormData = {
password: '',
Expand Down Expand Up @@ -36,7 +37,7 @@ const UpdatePassword = () => {
{globalError ? <AlertError message={globalError}/> : ''}
<div className='d-flex align-items-center justify-content-center'>
<div className='col-3'>
<img alt='doky logo' className='mb-3 mt-3 img-fluid' src='/logo-color-bg.svg'/>
<Logo/>
<form onSubmit={handleSubmit}>
<FormInput id='password' label='Password' type='password' value={data.password}
onChange={password.setValue}
Expand Down

0 comments on commit d00f4e8

Please sign in to comment.