Design Auth index (#325)

This commit is contained in:
Charles Bochet
2023-06-18 23:51:59 +02:00
committed by GitHub
parent ffa8318e2e
commit 5904a39362
17 changed files with 325 additions and 7 deletions

View File

@ -0,0 +1,52 @@
import React from 'react';
import styled from '@emotion/styled';
type OwnProps = {
label: string;
icon?: React.ReactNode;
fullWidth?: boolean;
onClick?: () => void;
};
const StyledButton = styled.button<{ fullWidth: boolean }>`
align-items: center;
background: radial-gradient(
50% 62.62% at 50% 0%,
${({ theme }) => theme.text60} 0%,
${({ theme }) => theme.text80} 100%
);
border: 1px solid ${({ theme }) => theme.primaryBorder};
border-radius: 8px;
box-shadow: 0px 0px 4px ${({ theme }) => theme.mediumBackgroundTransparent} 0%,
0px 2px 4px ${({ theme }) => theme.lightBackgroundTransparent} 0%;
color: ${(props) => props.theme.text0};
cursor: pointer;
display: flex;
flex-direction: row;
font-weight: ${({ theme }) => theme.fontWeightBold};
gap: 8px;
justify-content: center;
padding: ${({ theme }) => theme.spacing(2)} ${({ theme }) => theme.spacing(3)};
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
`;
export function PrimaryButton({
label,
icon,
fullWidth,
onClick,
}: OwnProps): JSX.Element {
return (
<StyledButton
fullWidth={fullWidth ?? false}
onClick={() => {
if (onClick) {
onClick();
}
}}
>
{icon}
{label}
</StyledButton>
);
}

View File

@ -0,0 +1,44 @@
import React from 'react';
import styled from '@emotion/styled';
type OwnProps = {
label: string;
icon?: React.ReactNode;
fullWidth?: boolean;
};
const StyledButton = styled.button<{ fullWidth: boolean }>`
align-items: center;
background: ${({ theme }) => theme.primaryBackground};
border: 1px solid ${({ theme }) => theme.primaryBorder};
border-radius: 8px;
box-shadow: 0px 0px 4px ${({ theme }) => theme.mediumBackgroundTransparent} 0%,
0px 2px 4px ${({ theme }) => theme.lightBackgroundTransparent} 0%;
color: ${(props) => props.theme.text80};
cursor: pointer;
display: flex;
flex-direction: row;
font-weight: ${({ theme }) => theme.fontWeightBold};
gap: 8px;
justify-content: center;
padding: ${({ theme }) => theme.spacing(2)} ${({ theme }) => theme.spacing(3)};
padding: 8px 32px;
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'auto')};
&:hover {
background: ${({ theme }) => theme.tertiaryBackground};
}
`;
export function SecondaryButton({
label,
icon,
fullWidth,
}: OwnProps): JSX.Element {
return (
<StyledButton fullWidth={fullWidth ?? false}>
{icon}
{label}
</StyledButton>
);
}

View File

@ -0,0 +1,11 @@
import styled from '@emotion/styled';
type OwnProps = {
text: string;
};
const StyledButton = styled.button``;
export function TertiaryButton({ text }: OwnProps): JSX.Element {
return <StyledButton>{text}</StyledButton>;
}

View File

@ -0,0 +1,49 @@
import { ChangeEvent, useState } from 'react';
import styled from '@emotion/styled';
type OwnProps = {
initialValue: string;
onChange: (text: string) => void;
fullWidth?: boolean;
};
const StyledInput = styled.input<{ fullWidth: boolean }>`
background-color: ${({ theme }) => theme.lighterBackgroundTransparent};
border: 1px solid ${({ theme }) => theme.lightBorder};
border-radius: 4px;
padding: ${({ theme }) => theme.spacing(2)} ${({ theme }) =>
theme.spacing(3)};
color: ${({ theme }) => theme.text80};
outline: none;
width: ${({ fullWidth, theme }) =>
fullWidth ? `calc(100% - ${theme.spacing(6)})` : 'auto'};
&::placeholder,
&::-webkit-input-placeholder {
color: ${({ theme }) => theme.text30}
font-family: ${({ theme }) => theme.fontFamily};;
font-weight: ${({ theme }) => theme.fontWeightMedium};
}
margin-bottom: ${({ theme }) => theme.spacing(3)};
`;
export function TextInput({
initialValue,
onChange,
fullWidth,
}: OwnProps): JSX.Element {
const [value, setValue] = useState(initialValue);
return (
<StyledInput
fullWidth={fullWidth ?? false}
value={value}
placeholder="Email"
onChange={(event: ChangeEvent<HTMLInputElement>) => {
setValue(event.target.value);
onChange(event.target.value);
}}
/>
);
}

View File

@ -7,6 +7,7 @@ export function Modal({ children }: { children: React.ReactNode }) {
return (
<ReactModal
isOpen
ariaHideApp={false}
style={{
overlay: {
backgroundColor: theme.modalBackgroundTransparent,
@ -15,7 +16,7 @@ export function Modal({ children }: { children: React.ReactNode }) {
justifyContent: 'center',
alignItems: 'center',
},
content: { zIndex: 1000, minWidth: 200, inset: 'auto' },
content: { zIndex: 1000, minWidth: 200, inset: 'auto', padding: 0 },
}}
>
{children}