Skip to content

Commit

Permalink
fix: Correct padding in sidebar header and footer
Browse files Browse the repository at this point in the history
  • Loading branch information
melissap-nulogy committed Sep 20, 2024
1 parent 6c59976 commit b91e90f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Layout/Sidebar.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export const WithHelpText = () => {
);

return (
<Sidebar hideCloseButton top={0} height="100%" isOpen title="With help text" helpText={helpText}>
<Sidebar footer={<PrimaryButton>Apply</PrimaryButton>} top={0} height="100%" isOpen title="With help text" helpText={helpText}>
<Textarea
value={helpText}
labelText="Help Text"
Expand Down
64 changes: 32 additions & 32 deletions src/Layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
import { Box } from "../Box";
import { Flex } from "../Flex";
import { IconicButton } from "../Button";
import { Heading3, Text } from "../Type";
import { Heading2, Text } from "../Type";
import { AnimatedBoxProps, AnimatedBox } from "../Box/Box";
import { NAVBAR_HEIGHT } from "../BrandedNavBar/NavBar";
import { PreventBodyElementScrolling } from "../utils";
Expand Down Expand Up @@ -170,6 +170,7 @@ function Sidebar({
)}
<AnimatedBox
role="dialog"
paddingX="x1"
bg="white"
display="flex"
flexDirection="column"
Expand All @@ -188,6 +189,36 @@ function Sidebar({
ref={sideBarRef as any}
{...props}
>
<Flex
flexDirection="column"
p="x2"
borderBottomWidth="1px"
borderBottomStyle="solid"
borderBottomColor="lightGrey"
>
<Flex flexDirection="column" gap="x1">
<Flex justifyContent="space-between" alignItems="flex-start">
{title && (
<Flex alignItems="center" height="100%">
<Heading2 mb={0}>{title}</Heading2>
</Flex>
)}
{!hideCloseButton && (
<Box marginLeft="x2">
<IconicButton
type="button"
ref={closeButton}
icon="close"
onClick={onClose}
data-testid={closeButtonTestId}
aria-label={closeButtonAriaLabel || t("close")}
/>
</Box>
)}
</Flex>
{renderHelpText ? renderHelpText() : helpText && <Text color="midGrey">{helpText}</Text>}
</Flex>
</Flex>
<Flex
p={p}
maxHeight="100%"
Expand All @@ -196,37 +227,6 @@ function Sidebar({
flexDirection="column"
style={{ overflowBehaviour: "contain" } as any}
>
<Flex flexDirection="column" pb="x3">
<Flex flexDirection="column" pb="x2">
<Flex justifyContent="space-between" alignItems="flex-start">
{title && (
<Flex alignItems="center" height="100%">
<Heading3 mb={0}>{title}</Heading3>
</Flex>
)}
{!hideCloseButton && (
<Box marginLeft="x2">
<IconicButton
type="button"
ref={closeButton}
icon="close"
onClick={onClose}
data-testid={closeButtonTestId}
aria-label={closeButtonAriaLabel || t("close")}
/>
</Box>
)}
</Flex>
{renderHelpText
? renderHelpText()
: helpText && (
<Text pt="x1" color="midGrey">
{helpText}
</Text>
)}
</Flex>
<Divider m="0 -8px" width="calc(100% + 16px)" />
</Flex>
<AnimatedBox
variants={childVariants}
animate={isOpen ? "open" : "closed"}
Expand Down

0 comments on commit b91e90f

Please sign in to comment.