Skip to content

Commit

Permalink
ensure segmented button group only adds dividers to buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyvc committed May 10, 2024
1 parent 318515c commit d26bcfc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gap: var(--salt-size-border);
}

.saltSegmentedButtonGroup > *:not(:last-child)::after {
.saltSegmentedButtonGroup > .saltButton:not(:last-of-type)::after {
content: "";
width: var(--salt-size-border);
position: absolute;
Expand All @@ -14,7 +14,7 @@
height: 100%;
}

.saltSegmentedButtonGroup > *:not(:first-child)::before {
.saltSegmentedButtonGroup > .saltButton:not(:first-of-type)::before {
content: "";
width: var(--salt-size-border);
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ import {
Tooltip,
SegmentedButtonGroup,
SegmentedButtonGroupProps,
Menu,
MenuItem,
MenuPanel,
MenuTrigger,
} from "@salt-ds/core";
import { MessageIcon, ChatGroupIcon, CallIcon } from "@salt-ds/icons";
import {
MessageIcon,
ChatGroupIcon,
CallIcon,
CopyIcon,
ExportIcon,
MicroMenuIcon,
SettingsIcon,
} from "@salt-ds/icons";
import { Meta, StoryFn } from "@storybook/react";

export default {
Expand Down Expand Up @@ -60,3 +72,33 @@ export const Icons: StoryFn<SegmentedButtonGroupProps> = () => {
</StackLayout>
);
};

export const WithMenu: StoryFn<SegmentedButtonGroupProps> = () => {
return (
<SegmentedButtonGroup>
<Button>Button</Button>
<Button>Button</Button>
<Menu>
<MenuTrigger>
<Button variant="secondary" aria-label="Open Menu">
<MicroMenuIcon aria-hidden />
</Button>
</MenuTrigger>
<MenuPanel>
<MenuItem>
<CopyIcon aria-hidden />
Copy
</MenuItem>
<MenuItem>
<ExportIcon aria-hidden />
Export
</MenuItem>
<MenuItem>
<SettingsIcon aria-hidden />
Settings
</MenuItem>
</MenuPanel>
</Menu>
</SegmentedButtonGroup>
);
};

0 comments on commit d26bcfc

Please sign in to comment.