Skip to content

Commit

Permalink
feat(EmptyState): add centered alignment option and update styles in …
Browse files Browse the repository at this point in the history
…stories
  • Loading branch information
JoannaSikora committed Jan 22, 2025
1 parent 7ba6653 commit 8ce8b46
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ $base-class: 'empty-state';
display: flex;
align-items: center;

&--centered {
justify-content: center;
width: 100%;
height: 100%;
}

&--inline {
flex-direction: row;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.empty-state-story {
&--centered {
display: flex;
justify-content: center;
height: 100vh;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const WithIcon: Story = {

export const Centered: Story = {
args: {
centered: true,
icon: (
<Icon className={styles['empty-state-story__icon']} source={InfoIcon} />
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ export const EmptyState = ({
title,
description,
actions,
centered = false,
}: IEmptyStateProps) => {
return (
<div className={cx(styles[baseClass], styles[`${baseClass}--${type}`])}>
<div
className={cx(
styles[baseClass],
styles[`${baseClass}--${type}`],
centered && styles[`${baseClass}--centered`]
)}
>
{image && (
<img
className={styles[`${baseClass}__image`]}
Expand Down
2 changes: 2 additions & 0 deletions packages/react-components/src/components/EmptyState/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export type IEmptyStateProps = (
| {
type: 'inline';
description?: never;
image?: never;
}
) & {
title: string;
actions?: ReactNode;
centered?: boolean;
} & (
| { image?: string; icon?: never }
| { image?: never; icon?: ReactNode }
Expand Down

0 comments on commit 8ce8b46

Please sign in to comment.