Redesign settings profile (#353)
* Redesign settings profile * Fix spacing * Fix Company creation
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { useCallback } from 'react';
|
||||||
import { useMatch, useResolvedPath } from 'react-router-dom';
|
import { useMatch, useResolvedPath } from 'react-router-dom';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
|
|
||||||
@ -14,6 +15,10 @@ import NavTitle from '@/ui/layout/navbar/NavTitle';
|
|||||||
import SubNavbarContainer from '@/ui/layout/navbar/sub-navbar/SubNavBarContainer';
|
import SubNavbarContainer from '@/ui/layout/navbar/sub-navbar/SubNavBarContainer';
|
||||||
|
|
||||||
export function SettingsNavbar() {
|
export function SettingsNavbar() {
|
||||||
|
const logout = useCallback(() => {
|
||||||
|
removeTokens();
|
||||||
|
window.location.href = '/';
|
||||||
|
}, []);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<SubNavbarContainer backButtonTitle="Settings">
|
<SubNavbarContainer backButtonTitle="Settings">
|
||||||
@ -58,7 +63,7 @@ export function SettingsNavbar() {
|
|||||||
<NavTitle label="Other" />
|
<NavTitle label="Other" />
|
||||||
<NavItem
|
<NavItem
|
||||||
label="Logout"
|
label="Logout"
|
||||||
onClick={removeTokens}
|
onClick={logout}
|
||||||
icon={<IconLogout size={theme.iconSizeMedium} />}
|
icon={<IconLogout size={theme.iconSizeMedium} />}
|
||||||
danger={true}
|
danger={true}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -19,8 +19,6 @@ export type EditableChipProps = {
|
|||||||
|
|
||||||
// TODO: refactor
|
// TODO: refactor
|
||||||
const StyledInplaceInput = styled.input`
|
const StyledInplaceInput = styled.input`
|
||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
|
||||||
padding-right: ${(props) => props.theme.spacing(2)};
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
${textInputStyle}
|
${textInputStyle}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ const StyledContainer = styled.div`
|
|||||||
|
|
||||||
const StyledEditInplaceInput = styled.input`
|
const StyledEditInplaceInput = styled.input`
|
||||||
height: 18px;
|
height: 18px;
|
||||||
margin: 0px ${(props) => props.theme.spacing(2)};
|
margin: 0;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
|
|
||||||
${textInputStyle}
|
${textInputStyle}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ type StyledEditModeProps = {
|
|||||||
|
|
||||||
// TODO: refactor
|
// TODO: refactor
|
||||||
const StyledEditInplaceInput = styled.input<StyledEditModeProps>`
|
const StyledEditInplaceInput = styled.input<StyledEditModeProps>`
|
||||||
margin: 0px ${(props) => props.theme.spacing(2)};
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
${textInputStyle}
|
${textInputStyle}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ type StyledEditModeProps = {
|
|||||||
|
|
||||||
// TODO: refactor
|
// TODO: refactor
|
||||||
const StyledInplaceInput = styled.input<StyledEditModeProps>`
|
const StyledInplaceInput = styled.input<StyledEditModeProps>`
|
||||||
margin: 0px ${(props) => props.theme.spacing(2)};
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
${textInputStyle}
|
${textInputStyle}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -24,9 +24,8 @@ export const Default: Story = {
|
|||||||
play: async ({ canvasElement }) => {
|
play: async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
expect(changeJestFn).toHaveBeenCalledTimes(0);
|
|
||||||
const input = canvas.getByRole('textbox');
|
const input = canvas.getByRole('textbox');
|
||||||
await userEvent.type(input, 'cou');
|
await userEvent.type(input, 'cou', { delay: 100 });
|
||||||
|
|
||||||
expect(changeJestFn).toHaveBeenNthCalledWith(1, 'A good value c');
|
expect(changeJestFn).toHaveBeenNthCalledWith(1, 'A good value c');
|
||||||
expect(changeJestFn).toHaveBeenNthCalledWith(2, 'A good value co');
|
expect(changeJestFn).toHaveBeenNthCalledWith(2, 'A good value co');
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import styled from '@emotion/styled';
|
|||||||
import { textInputStyle } from '@/ui/layout/styles/themes';
|
import { textInputStyle } from '@/ui/layout/styles/themes';
|
||||||
|
|
||||||
export const DropdownMenuSearchContainer = styled.div`
|
export const DropdownMenuSearchContainer = styled.div`
|
||||||
--horizontal-padding: ${(props) => props.theme.spacing(2)};
|
|
||||||
--vertical-padding: ${(props) => props.theme.spacing(1)};
|
--vertical-padding: ${(props) => props.theme.spacing(1)};
|
||||||
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -13,9 +12,9 @@ export const DropdownMenuSearchContainer = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: calc(36px - 2 * var(--vertical-padding));
|
height: calc(36px - 2 * var(--vertical-padding));
|
||||||
padding: var(--vertical-padding) var(--horizontal-padding);
|
padding: var(--vertical-padding) 0;
|
||||||
|
|
||||||
width: calc(100% - 2 * var(--horizontal-padding));
|
width: calc(100%);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledEditModeSearchInput = styled.input`
|
const StyledEditModeSearchInput = styled.input`
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledMainSectionTitle = styled.h2`
|
||||||
|
color: ${({ theme }) => theme.text80};
|
||||||
|
font-size: ${({ theme }) => theme.fontSizeExtraLarge};
|
||||||
|
font-weight: ${({ theme }) => theme.fontWeightBold};
|
||||||
|
line-height: 1.5;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function MainSectionTitle({ children }: OwnProps) {
|
||||||
|
return <StyledMainSectionTitle>{children}</StyledMainSectionTitle>;
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
|
type OwnProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
const StyledSubSectionTitle = styled.h2`
|
||||||
|
color: ${({ theme }) => theme.text80};
|
||||||
|
font-size: ${({ theme }) => theme.fontSizeMedium};
|
||||||
|
font-weight: ${({ theme }) => theme.fontWeightBold};
|
||||||
|
line-height: 1.5;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function SubSectionTitle({ children }: OwnProps) {
|
||||||
|
return <StyledSubSectionTitle>{children}</StyledSubSectionTitle>;
|
||||||
|
}
|
||||||
@ -46,7 +46,7 @@ const StyledIcon = styled.div`
|
|||||||
margin-right: ${(props) => props.theme.spacing(2)};
|
margin-right: ${(props) => props.theme.spacing(2)};
|
||||||
|
|
||||||
& > svg {
|
& > svg {
|
||||||
font-size: ${(props) => props.theme.fontSizeLarge};
|
font-size: ${(props) => props.theme.iconSizeSmall};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ const StyledLogo = styled.div<StyledLogoProps>`
|
|||||||
const StyledName = styled.div`
|
const StyledName = styled.div`
|
||||||
color: ${(props) => props.theme.text80};
|
color: ${(props) => props.theme.text80};
|
||||||
font-family: 'Inter';
|
font-family: 'Inter';
|
||||||
font-size: ${(props) => props.theme.fontSizeLarge};
|
font-size: ${(props) => props.theme.fontSizeMedium};
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-left: ${(props) => props.theme.spacing(1)};
|
margin-left: ${(props) => props.theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ export const commonText = {
|
|||||||
fontSizeExtraSmall: '0.85rem',
|
fontSizeExtraSmall: '0.85rem',
|
||||||
fontSizeSmall: '0.92rem',
|
fontSizeSmall: '0.92rem',
|
||||||
fontSizeMedium: '1rem',
|
fontSizeMedium: '1rem',
|
||||||
fontSizeLarge: '1.08rem',
|
fontSizeLarge: '1.23rem',
|
||||||
fontSizeExtraLarge: '1.54rem',
|
fontSizeExtraLarge: '1.54rem',
|
||||||
|
|
||||||
fontWeightMedium: 500,
|
fontWeightMedium: 500,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
import { getOperationName } from '@apollo/client/utilities';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
@ -6,6 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
import {
|
import {
|
||||||
CompaniesSelectedSortType,
|
CompaniesSelectedSortType,
|
||||||
defaultOrderBy,
|
defaultOrderBy,
|
||||||
|
GET_COMPANIES,
|
||||||
useCompaniesQuery,
|
useCompaniesQuery,
|
||||||
} from '@/companies/services';
|
} from '@/companies/services';
|
||||||
import {
|
import {
|
||||||
@ -67,7 +69,10 @@ export function Companies() {
|
|||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
await insertCompany({ variables: newCompany });
|
await insertCompany({
|
||||||
|
variables: newCompany,
|
||||||
|
refetchQueries: [getOperationName(GET_COMPANIES) ?? ''],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const companiesColumns = useCompaniesColumns();
|
const companiesColumns = useCompaniesColumns();
|
||||||
|
|||||||
@ -2,28 +2,37 @@ 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 { TextInput } from '@/ui/components/inputs/TextInput';
|
||||||
|
import { MainSectionTitle } from '@/ui/components/section-titles/MainSectionTitle';
|
||||||
|
import { SubSectionTitle } from '@/ui/components/section-titles/SubSectionTitle';
|
||||||
import { NoTopBarContainer } from '@/ui/layout/containers/NoTopBarContainer';
|
import { NoTopBarContainer } from '@/ui/layout/containers/NoTopBarContainer';
|
||||||
import { TopTitle } from '@/ui/layout/top-bar/TopTitle';
|
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: ${(props) => props.theme.spacing(8)};
|
padding: ${(props) => props.theme.spacing(8)};
|
||||||
|
width: 490px;
|
||||||
`;
|
`;
|
||||||
export function SettingsProfile() {
|
export function SettingsProfile() {
|
||||||
const currentUser = useRecoilValue(currentUserState);
|
const currentUser = useRecoilValue(currentUserState);
|
||||||
return (
|
return (
|
||||||
<NoTopBarContainer>
|
<NoTopBarContainer>
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<TopTitle title="Profile" />
|
<MainSectionTitle>Profile</MainSectionTitle>
|
||||||
<div>
|
<SubSectionTitle>Name</SubSectionTitle>
|
||||||
<h5>Name</h5>
|
<TextInput
|
||||||
<span>{currentUser?.displayName} </span>
|
value={currentUser?.displayName}
|
||||||
</div>
|
disabled
|
||||||
<div>
|
fullWidth
|
||||||
<h5>Email</h5>
|
key={'id-' + currentUser?.id}
|
||||||
<span>{currentUser?.email} </span>
|
/>
|
||||||
</div>
|
<SubSectionTitle>Email</SubSectionTitle>
|
||||||
|
<TextInput
|
||||||
|
value={currentUser?.email}
|
||||||
|
disabled
|
||||||
|
fullWidth
|
||||||
|
key={'email-' + currentUser?.id}
|
||||||
|
/>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
</NoTopBarContainer>
|
</NoTopBarContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user