Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UI refinements #825

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Trans } from "@lingui/macro";
import { Box, Theme, Typography } from "@mui/material";
import { makeStyles } from "@mui/styles";
import NextLink from "next/link";
import { useRouter } from "next/router";
import React, {
Dispatch,
SetStateAction,
Expand Down Expand Up @@ -68,35 +69,44 @@ export const HeaderBorder = () => {
);
};

const useHeaderStyles = makeStyles<Theme, { isConfiguring: boolean }>(
(theme) => ({
wrapper: {
position: "fixed",
top: 0,
left: 0,
width: "100%",
overflowY: "hidden",
zIndex: 13,
backgroundColor: theme.palette.grey[100],
},
content: {
minHeight: 92,
maxWidth: ({ isConfiguring }) => (isConfiguring ? undefined : 1400),
marginLeft: "auto",
marginRight: "auto",
color: theme.palette.grey[700],
},
})
);

export const Header = ({
pageType = "app",
}: {
pageType?: "content" | "app";
}) => {
const router = useRouter();
const isConfiguring = router.pathname === "/create/[chartId]";
const classes = useHeaderStyles({ isConfiguring });

return (
<Box
sx={
pageType == "content"
? undefined
: {
position: "fixed",
top: 0,
left: 0,
width: "100%",
overflowY: "hidden",
zIndex: 13,
}
}
>
<Box className={pageType === "app" ? classes.wrapper : undefined}>
<Flex
component="header"
className={classes.content}
sx={{
px: [0, 4, 4],
pt: [0, 3, 3],
minHeight: 92,

backgroundColor: "grey.100",
color: "grey.700",
flexDirection: ["column", "row"],
}}
>
Expand Down
1 change: 0 additions & 1 deletion app/configurator/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const useStyles = makeStyles((theme: Theme) => ({
// FIXME replace 96px with actual header size
top: 96,
width: "100%",
maxWidth: 1400,
height: "calc(100vh - 96px)",
display: "grid",
gridTemplateColumns:
Expand Down
2 changes: 1 addition & 1 deletion app/configurator/components/select-dataset-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const softJSONParse = (v: string) => {

const useStyles = makeStyles<Theme, { datasetPresent: boolean }>((theme) => ({
panelLayout: {
width: "100%",
maxWidth: 1400,
margin: "auto",
position: "static",
marginTop: ({ datasetPresent }) => (datasetPresent ? 96 : 0),
Expand Down