Skip to content

Commit

Permalink
feat(layout): more buttons in header
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmord committed Mar 30, 2020
1 parent e8bd352 commit 9e65697
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions packages/poolbase-app/design-system/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ export const colors = {
grayDark: baseColors.gray[8],
text: baseColors.gray[8],
textInverted: baseColors.gray[2],
background: baseColors.white,
background: baseColors.gray[2],
backgroundInverted: baseColors.gray[8],
primary: baseColors.blue[7],
primaryHover: baseColors.blue[8],
secondary: baseColors.gray[6],
Expand All @@ -165,9 +166,10 @@ export const colors = {
textMuted: baseColors.gray[6],
modes: {
dark: {
text: baseColors.gray[2],
textInverted: baseColors.gray[3],
text: baseColors.gray[4],
textInverted: baseColors.gray[5],
background: baseColors.gray[9],
backgroundInverted: baseColors.black,
primary: '#0cf',
secondary: '#90c',
},
Expand Down Expand Up @@ -380,6 +382,7 @@ const heading = {
lineHeight: 'heading',
m: 0,
mb: 1,
color: 'text',
};

export const styles = {
Expand Down
45 changes: 26 additions & 19 deletions packages/poolbase-app/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,46 @@ import logout from '../utils/auth/logout';
import Moon from '../../../design-system/assets/svg/moon.svg';
import Sun from '../../../design-system/assets/svg/sun.svg';
import Logout from '../../../design-system/assets/svg/log-out.svg';
import Add from '../../../design-system/assets/svg/plus-square.svg';

interface PropsWithAuthUser {
AuthUser: AuthUser;
}

const NaviIconButton = props => (
<IconButton
{...props}
sx={{
color: 'textInverted',
width: 10,
height: 10,
display: 'flex',
my: 1,
}}
/>
);
export default function Header({ AuthUser }: PropsWithAuthUser): JSX.Element {
const [colorMode, setColorMode] = useColorMode();
return (
<header
sx={{
bg: 'grayDark',
bg: 'backgroundInverted',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
}}
>
<IconButton
aria-label="Log out"
sx={{
color: 'textInverted',
width: 10,
height: 10,
display: 'flex',
my: 1,
<NaviIconButton
aria-label="Add URL"
onClick={(): void => {
Router.push('/add-url');
}}
>
<Add />
</NaviIconButton>
<NaviIconButton
aria-label="Log out"
onClick={async (): Promise<void> => {
try {
await logout();
Expand All @@ -43,20 +57,13 @@ export default function Header({ AuthUser }: PropsWithAuthUser): JSX.Element {
}}
>
<Logout />
</IconButton>
<IconButton
sx={{
color: 'textInverted',
width: 10,
height: 10,
display: 'flex',
my: 1,
}}
</NaviIconButton>
<NaviIconButton
onClick={(): void => setColorMode(colorMode === 'light' ? 'dark' : 'light')}
aria-label={`Toggle ${colorMode === 'light' ? 'Dark' : 'Light'}`}
>
{colorMode === 'light' ? <Moon /> : <Sun />}
</IconButton>
</NaviIconButton>
</header>
);
}
4 changes: 2 additions & 2 deletions packages/poolbase-app/src/app/components/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const PageLayout: NextPage<PropsWithAuthUserInfo> = (
) : (
<Grid
gap={0}
columns={[0, '200px 1fr']}
columns={[0, '150px 1fr']}
sx={{
height: '100%',
}}
>
<Header AuthUser={AuthUser} />
<div>{children}</div>
<main sx={{ px: 4 }}>{children}</main>
</Grid>
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/poolbase-app/src/app/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class CustomDocument extends Document<CustomDocumentProps> {
height: '100%',
'& > div': {
height: '100%',
}
},
}}
>
<Main />
Expand Down

0 comments on commit 9e65697

Please sign in to comment.