feat: ui settings (#465)

This commit is contained in:
Jérémy M
2023-06-30 11:35:01 +02:00
committed by GitHub
parent 91608a37f2
commit 19a1f2b9f8
6 changed files with 91 additions and 31 deletions

View File

@ -10,6 +10,7 @@ const StyledMainSectionTitle = styled.h2`
font-size: ${({ theme }) => theme.font.size.xl}; font-size: ${({ theme }) => theme.font.size.xl};
font-weight: ${({ theme }) => theme.font.weight.semiBold}; font-weight: ${({ theme }) => theme.font.weight.semiBold};
line-height: 1.5; line-height: 1.5;
margin: 0;
`; `;
export function MainSectionTitle({ children }: OwnProps) { export function MainSectionTitle({ children }: OwnProps) {

View File

@ -1,17 +1,35 @@
import { ReactNode } from 'react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
type OwnProps = { type Props = {
children: ReactNode; title: string;
description?: string;
}; };
const StyledSubSectionTitle = styled.h2` const StyledContainer = styled.div`
display: flex;
flex-direction: column;
`;
const StyledTitle = styled.h2`
color: ${({ theme }) => theme.font.color.primary}; color: ${({ theme }) => theme.font.color.primary};
font-size: ${({ theme }) => theme.font.size.md}; font-size: ${({ theme }) => theme.font.size.md};
font-weight: ${({ theme }) => theme.font.weight.semiBold}; font-weight: ${({ theme }) => theme.font.weight.semiBold};
line-height: 1.5; margin: 0;
`; `;
export function SubSectionTitle({ children }: OwnProps) { const StyledDescription = styled.h3`
return <StyledSubSectionTitle>{children}</StyledSubSectionTitle>; color: ${({ theme }) => theme.font.color.tertiary};
font-size: ${({ theme }) => theme.font.size.md};
font-weight: ${({ theme }) => theme.font.weight.regular};
margin: 0;
margin-top: ${({ theme }) => theme.spacing(1)};
`;
export function SubSectionTitle({ title, description }: Props) {
return (
<StyledContainer>
<StyledTitle>{title}</StyledTitle>
{description && <StyledDescription>{description}</StyledDescription>}
</StyledContainer>
);
} }

View File

@ -3,12 +3,12 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { Section } from '@/auth/components/ui/Section';
import { SubTitle } from '@/auth/components/ui/SubTitle'; import { SubTitle } from '@/auth/components/ui/SubTitle';
import { Title } from '@/auth/components/ui/Title'; import { Title } from '@/auth/components/ui/Title';
import { MainButton } from '@/ui/components/buttons/MainButton'; import { MainButton } from '@/ui/components/buttons/MainButton';
import { ImageInput } from '@/ui/components/inputs/ImageInput'; import { ImageInput } from '@/ui/components/inputs/ImageInput';
import { TextInput } from '@/ui/components/inputs/TextInput'; import { TextInput } from '@/ui/components/inputs/TextInput';
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
const StyledContentContainer = styled.div` const StyledContentContainer = styled.div`
width: 100%; width: 100%;
@ -60,11 +60,11 @@ export function CreateProfile() {
<SubTitle>How you'll be identify on the app.</SubTitle> <SubTitle>How you'll be identify on the app.</SubTitle>
<StyledContentContainer> <StyledContentContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section title="Picture" /> <SubSectionTitle title="Picture" />
<ImageInput picture={null} disabled /> <ImageInput picture={null} disabled />
</StyledSectionContainer> </StyledSectionContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section <SubSectionTitle
title="Name" title="Name"
description="Your name as it will be displayed on the app" description="Your name as it will be displayed on the app"
/> />

View File

@ -3,12 +3,12 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { Section } from '@/auth/components/ui/Section';
import { SubTitle } from '@/auth/components/ui/SubTitle'; import { SubTitle } from '@/auth/components/ui/SubTitle';
import { Title } from '@/auth/components/ui/Title'; import { Title } from '@/auth/components/ui/Title';
import { MainButton } from '@/ui/components/buttons/MainButton'; import { MainButton } from '@/ui/components/buttons/MainButton';
import { ImageInput } from '@/ui/components/inputs/ImageInput'; import { ImageInput } from '@/ui/components/inputs/ImageInput';
import { TextInput } from '@/ui/components/inputs/TextInput'; import { TextInput } from '@/ui/components/inputs/TextInput';
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
const StyledContentContainer = styled.div` const StyledContentContainer = styled.div`
width: 100%; width: 100%;
@ -55,11 +55,11 @@ export function CreateWorkspace() {
</SubTitle> </SubTitle>
<StyledContentContainer> <StyledContentContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section title="Workspace logo" /> <SubSectionTitle title="Workspace logo" />
<ImageInput picture={null} disabled /> <ImageInput picture={null} disabled />
</StyledSectionContainer> </StyledSectionContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section <SubSectionTitle
title="Workspace name" title="Workspace name"
description="The name of your organization" description="The name of your organization"
/> />

View File

@ -5,7 +5,6 @@ import { motion } from 'framer-motion';
import { useRecoilState } from 'recoil'; import { useRecoilState } from 'recoil';
import { Logo } from '@/auth/components/ui/Logo'; import { Logo } from '@/auth/components/ui/Logo';
import { Section } from '@/auth/components/ui/Section';
import { SubTitle } from '@/auth/components/ui/SubTitle'; import { SubTitle } from '@/auth/components/ui/SubTitle';
import { Title } from '@/auth/components/ui/Title'; import { Title } from '@/auth/components/ui/Title';
import { useAuth } from '@/auth/hooks/useAuth'; import { useAuth } from '@/auth/hooks/useAuth';
@ -14,6 +13,7 @@ import { isMockModeState } from '@/auth/states/isMockModeState';
import { captureHotkeyTypeInFocusState } from '@/hotkeys/states/captureHotkeyTypeInFocusState'; import { captureHotkeyTypeInFocusState } from '@/hotkeys/states/captureHotkeyTypeInFocusState';
import { MainButton } from '@/ui/components/buttons/MainButton'; import { MainButton } from '@/ui/components/buttons/MainButton';
import { TextInput } from '@/ui/components/inputs/TextInput'; import { TextInput } from '@/ui/components/inputs/TextInput';
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
const StyledContentContainer = styled.div` const StyledContentContainer = styled.div`
width: 100%; width: 100%;
@ -101,7 +101,7 @@ export function PasswordLogin() {
<StyledAnimatedContent> <StyledAnimatedContent>
<StyledContentContainer> <StyledContentContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section title="Email" /> <SubSectionTitle title="Email" />
<TextInput <TextInput
value={authFlowUserEmail} value={authFlowUserEmail}
placeholder="Email" placeholder="Email"
@ -110,7 +110,7 @@ export function PasswordLogin() {
/> />
</StyledSectionContainer> </StyledSectionContainer>
<StyledSectionContainer> <StyledSectionContainer>
<Section title="Password" /> <SubSectionTitle title="Password" />
<TextInput <TextInput
value={internalPassword} value={internalPassword}
placeholder="Password" placeholder="Password"

View File

@ -2,6 +2,7 @@ import styled from '@emotion/styled';
import { useRecoilValue } from 'recoil'; import { useRecoilValue } from 'recoil';
import { currentUserState } from '@/auth/states/currentUserState'; import { currentUserState } from '@/auth/states/currentUserState';
import { ImageInput } from '@/ui/components/inputs/ImageInput';
import { TextInput } from '@/ui/components/inputs/TextInput'; import { TextInput } from '@/ui/components/inputs/TextInput';
import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle'; import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle';
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle'; import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
@ -11,28 +12,68 @@ const StyledContainer = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: ${({ theme }) => theme.spacing(8)}; padding: ${({ theme }) => theme.spacing(8)};
width: 490px; width: 350px;
> * + * {
margin-top: ${({ theme }) => theme.spacing(8)};
}
`; `;
const StyledSectionContainer = styled.div`
> * + * {
margin-top: ${({ theme }) => theme.spacing(4)};
}
`;
const StyledComboInputContainer = styled.div`
display: flex;
flex-direction: row;
> * + * {
margin-left: ${({ theme }) => theme.spacing(4)};
}
`;
export function SettingsProfile() { export function SettingsProfile() {
const currentUser = useRecoilValue(currentUserState); const currentUser = useRecoilValue(currentUserState);
return ( return (
<NoTopBarContainer> <NoTopBarContainer>
<StyledContainer> <StyledContainer>
<MainSectionTitle>Profile</MainSectionTitle> <MainSectionTitle>Profile</MainSectionTitle>
<SubSectionTitle>Name</SubSectionTitle> <StyledSectionContainer>
<TextInput <SubSectionTitle title="Picture" />
value={currentUser?.displayName} <ImageInput picture={null} disabled />
disabled </StyledSectionContainer>
fullWidth <StyledSectionContainer>
key={'id-' + currentUser?.id} <SubSectionTitle
/> title="Name"
<SubSectionTitle>Email</SubSectionTitle> description="Your name as it will be displayed"
<TextInput />
value={currentUser?.email} <StyledComboInputContainer>
disabled <TextInput
fullWidth label="First Name"
key={'email-' + currentUser?.id} value={currentUser?.displayName}
/> placeholder="Tim"
fullWidth
/>
<TextInput
label="Last Name"
value=""
placeholder="Cook"
fullWidth
/>
</StyledComboInputContainer>
</StyledSectionContainer>
<StyledSectionContainer>
<SubSectionTitle
title="Email"
description="The email associated to your account"
/>
<TextInput
value={currentUser?.email}
disabled
fullWidth
key={'email-' + currentUser?.id}
/>
</StyledSectionContainer>
</StyledContainer> </StyledContainer>
</NoTopBarContainer> </NoTopBarContainer>
); );