Skip to content

Commit cea99c0

Browse files
authored
Unauthed page improvements (#46)
1 parent 6826e55 commit cea99c0

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

app/src/core/components/withTextField.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TextField as MuiTextField, TextFieldProps } from '@mui/material';
22
import { useState } from 'react';
33
import { Control, Controller, FieldPath, FieldValues, Path, RegisterOptions } from 'react-hook-form';
4-
import styled from 'styled-components';
4+
import styled, { css } from 'styled-components';
55
import { SomeZodObject } from 'zod';
66

77
import { getLabelFromSchema } from '~/core/utils/zod';
@@ -20,6 +20,28 @@ const TextField = styled(MuiTextField)`
2020
background: ${({ theme }) => theme.palette.background.paper};
2121
}
2222
23+
${({ theme }) =>
24+
theme.palette.mode === 'dark' &&
25+
css`
26+
& .MuiOutlinedInput-root {
27+
&.Mui-focused fieldset {
28+
border-color: ${({ theme }) => theme.palette.grey[200]};
29+
}
30+
&.Mui-error fieldset {
31+
border-color: ${({ theme }) => theme.palette.error.main} !important;
32+
}
33+
}
34+
35+
& .MuiFormLabel-root {
36+
&.Mui-focused {
37+
color: ${({ theme }) => theme.palette.grey[200]};
38+
&.Mui-error {
39+
color: ${({ theme }) => theme.palette.error.main};
40+
}
41+
}
42+
}
43+
`}
44+
2345
& .MuiInputBase-input.Mui-disabled {
2446
cursor: not-allowed !important;
2547
}

app/src/features/authentication/public/ForgotPasswordView.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Box, Container } from '@mui/material';
2-
import { useEffect, useState } from 'react';
2+
import { useEffect, useMemo, useState } from 'react';
33
import Lottie from 'react-lottie-player';
44
import { Link } from 'react-router-dom';
55
import styled, { css } from 'styled-components';
@@ -83,6 +83,8 @@ function ForgotPasswordView() {
8383
const { isDesktop } = useWindowSize();
8484
const [animationData, setAnimationData] = useState<object>();
8585

86+
const memoizedGSplash = useMemo(() => <GSplash />, []);
87+
8688
useEffect(() => {
8789
import('~/assets/lottie/ForgotPassword.json').then(setAnimationData);
8890
}, []);
@@ -91,11 +93,7 @@ function ForgotPasswordView() {
9193
<>
9294
<UnauthorizedRootCss />
9395
<FormBoxContainer>
94-
{isDesktop && (
95-
<ImageBox>
96-
<GSplash />
97-
</ImageBox>
98-
)}
96+
{isDesktop && <ImageBox>{memoizedGSplash}</ImageBox>}
9997
<FormBox>
10098
<ColorModeToggle style={{ position: 'absolute', right: 10, top: 10 }} />
10199
<CenteredContainer>

app/src/features/authentication/public/LoginView.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Box, Container, Grid2 } from '@mui/material';
2-
import { useEffect, useState } from 'react';
2+
import { useEffect, useMemo, useState } from 'react';
33
import Lottie from 'react-lottie-player';
44
import { useLocation } from 'react-router';
55
import { Link, useSearchParams } from 'react-router-dom';
@@ -92,6 +92,8 @@ function Login() {
9292

9393
const [animationData, setAnimationData] = useState<object>();
9494

95+
const memoizedGSplash = useMemo(() => <GSplash />, []);
96+
9597
useEffect(() => {
9698
import('~/assets/lottie/landing.json').then(setAnimationData);
9799
}, []);
@@ -101,11 +103,7 @@ function Login() {
101103
<UnauthorizedRootCss />
102104

103105
<FormBoxContainer>
104-
{isDesktop && (
105-
<ImageBox>
106-
<GSplash />
107-
</ImageBox>
108-
)}
106+
{isDesktop && <ImageBox>{memoizedGSplash}</ImageBox>}
109107
<FormBox>
110108
<ColorModeToggle style={{ position: 'absolute', right: 10, top: 10 }} />
111109
<CenteredContainer>

0 commit comments

Comments
 (0)