Skip to content

Commit

Permalink
Fixed Badge occupying space when it is anchored to a child component (#…
Browse files Browse the repository at this point in the history
…2714)

Co-authored-by: Josh Wooding <[email protected]>
  • Loading branch information
lilyvc and joshwooding authored Nov 13, 2023
1 parent 1ea2d86 commit f3143bb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-masks-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/lab": patch
---

Fixed Badge occupying space when it is anchored to a child component.
4 changes: 2 additions & 2 deletions packages/lab/src/badge/Badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

.saltBadge-topRight {
position: relative;
top: calc(-1 * var(--salt-spacing-100));
position: absolute;
right: var(--salt-spacing-100);
transform: translateX(100%);
}
31 changes: 29 additions & 2 deletions packages/lab/stories/badge/badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Badge, Tabstrip, List, ListItem } from "@salt-ds/lab";
import { Button } from "@salt-ds/core";
import { Badge, List, ListItem } from "@salt-ds/lab";
import { Button, FlexLayout, StackLayout } from "@salt-ds/core";

import {
SettingsSolidIcon,
MessageIcon,
NotificationIcon,
ThumbsDownIcon,
ThumbsUpIcon,
} from "@salt-ds/icons";

import { Meta, StoryFn } from "@storybook/react";
Expand Down Expand Up @@ -74,3 +76,28 @@ export const ListStory: StoryFn<typeof Badge> = () => {
</List>
);
};

export const MultipleButtons: StoryFn<typeof Badge> = () => {
return (
<StackLayout>
<FlexLayout>
<Badge value={20}>
<Button>
<ThumbsUpIcon />
</Button>
</Badge>
<Button>
<ThumbsDownIcon />
</Button>
</FlexLayout>
<FlexLayout>
<Button>
<ThumbsUpIcon />
</Button>
<Button>
<ThumbsDownIcon />
</Button>
</FlexLayout>
</StackLayout>
);
};

1 comment on commit f3143bb

@vercel
Copy link

@vercel vercel bot commented on f3143bb Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.