Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Modal: no title, no description dont render extra margin-top
Browse files Browse the repository at this point in the history
  • Loading branch information
cy committed Aug 23, 2021
1 parent 677610b commit 664ee76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
23 changes: 23 additions & 0 deletions src/Modal/Modal.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,27 @@ storiesOf("Modal", module)
.join(" ")}
</div>
</Modal>
))
.add("No title and no description", () => (
<Modal
size="medium"
verticalScrollMode="children"
primaryAction={
<Button color={colors.green.base} style={{ color: colors.white }}>
Buy 1 Seat
</Button>
}
secondaryAction={<Button color={colors.white}>Cancel</Button>}
bottomLeftText={
<span style={{ color: colors.blue.base }}>
Update Billing Information
</span>
}
>
<div>
{Array.from(Array(500))
.map(() => "lorem ipsum dolor")
.join(" ")}
</div>
</Modal>
));
11 changes: 6 additions & 5 deletions src/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ interface Props {
/**
* Title of the modal
*/
title: React.ReactNode;
title?: React.ReactNode;
}

const modalBackdrop = css`
Expand Down Expand Up @@ -285,10 +285,11 @@ export const Modal: React.FC<Props> = ({
</div>
<div
css={css(
{
marginTop:
size === "large" ? 24 : size === "medium" ? 16 : 12,
},
title &&
description && {
marginTop:
size === "large" ? 24 : size === "medium" ? 16 : 12,
},
verticalScrollMode === "children" && {
overflowY: "auto",
},
Expand Down

0 comments on commit 664ee76

Please sign in to comment.