Skip to content

Commit

Permalink
Fix alignment when close button is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
frankieyan committed Oct 23, 2024
1 parent ba24909 commit f7ac71e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/alert/alert.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
border-width: 1px;
color: var(--reactist-content-primary);
padding: var(--reactist-spacing-small);
}

.content {
/* this is to make sure it always has the same minimum height, whether it has a close button or not */
min-height: calc(2 * var(--reactist-spacing-small) + var(--reactist-button-small-height) + 2px);
min-height: var(--reactist-button-small-height);
}

.icon {
display: block;
}

.tone-info {
Expand Down
7 changes: 4 additions & 3 deletions src/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ function Alert({ id, children, tone, closeLabel, onClose }: AlertProps) {
>
<Columns space="small" alignY="center">
<Column width="content">
<Box display="flex" alignItems="center">
<AlertIcon tone={tone} className={styles.icon} />
</Box>
<AlertIcon tone={tone} className={styles.icon} />
</Column>
<Column>
<Box
paddingY="xsmall"
paddingRight={onClose != null && closeLabel != null ? undefined : 'small'}
display="flex"
alignItems="center"
className={styles.content}
>
{children}
</Box>
Expand Down

0 comments on commit f7ac71e

Please sign in to comment.