This commit is contained in:
Manav Rathi
2024-11-04 18:19:40 +05:30
parent 5311714bff
commit cbe7407c14
3 changed files with 19 additions and 7 deletions

View File

@@ -1,5 +1,19 @@
import { styled } from "@mui/material";
/**
* A flexbox with justify content set to space-between and center alignment.
*
* There is also another SpaceBetweenFlex in the old shared package, but that
* one also sets width: 100%. As such, that one should be considered deprecated
* and its uses moved to this one when possible (so that we can then see where
* the width: 100% is essential).
*/
export const SpaceBetweenFlex = styled("div")`
display: flex;
justify-content: space-between;
align-items: center;
`;
/**
* A flex child that fills the entire flex direction, and shows its children
* after centering them both vertically and horizontally.

View File

@@ -75,11 +75,11 @@ export const NestedSidebarDrawer: React.FC<
);
};
import { FlexWrapper } from "@ente/shared/components/Container";
import ArrowBack from "@mui/icons-material/ArrowBack";
import Close from "@mui/icons-material/Close";
import { Box, IconButton, Typography } from "@mui/material";
import React from "react";
import { SpaceBetweenFlex } from "./Container";
type SidebarDrawerTitlebarProps = Pick<
NestedSidebarDrawerVisibilityProps,
@@ -109,11 +109,7 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
}) => {
return (
<Stack sx={{ gap: "4px" }}>
<FlexWrapper
height={48}
alignItems={"center"}
justifyContent="space-between"
>
<SpaceBetweenFlex sx={{ minHeight: "48px" }}>
<IconButton onClick={onClose} color={"primary"}>
<ArrowBack />
</IconButton>
@@ -123,7 +119,7 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
<Close />
</IconButton>
</Box>
</FlexWrapper>
</SpaceBetweenFlex>
<Box py={0.5} px={2}>
<Typography variant="h3" fontWeight={"bold"}>
{title}

View File

@@ -19,6 +19,8 @@ export const FilledIconButton = styled(IconButton)(({ theme }) => ({
* one also sets width: 100%. As such, that one should be considered deprecated
* and its uses moved to this one when possible (so that we can then see where
* the width: 100% is essential).
*
* TODO: Moved to base.
*/
export const SpaceBetweenFlex = styled(Box)`
display: flex;