Skip to content

Commit 5415c9d

Browse files
authored
feat(ActionGroup): support switch (#1105)
* feat(ActionGroup): support switch * feat(ActionGroup): support switch
1 parent 4f7fd92 commit 5415c9d

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

packages/components/src/components/ActionGroup/ActionGroup.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.actionGroup {
22
display: flex;
3+
align-items: center;
34

45
.primary {
56
order: 3;
7+
68
&:only-child {
79
margin-left: auto;
810
}

packages/components/src/components/ActionGroup/ActionGroup.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ export const ActionGroup = flowComponent("ActionGroup", (props) => {
4646
return clsx(props.className, styles[slot]);
4747
}),
4848
},
49+
Switch: {
50+
labelPosition: "leading",
51+
className: dynamic((props) => {
52+
return clsx(props.className, props.slot && styles[props.slot]);
53+
}),
54+
},
4955
};
5056

5157
return (

packages/components/src/components/ActionGroup/stories/Default.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from "react";
44
import { Button } from "@/components/Button";
55
import { Action } from "@/components/Action";
66
import { sleep } from "@/lib/promises/sleep";
7+
import { Switch } from "@/components/Switch";
78

89
const meta: Meta<typeof ActionGroup> = {
910
title: "Actions/ActionGroup",
@@ -85,3 +86,12 @@ export const WithExtraSecondaryAction: Story = {
8586
export const Mobile: Story = {
8687
parameters: { viewport: { defaultViewport: "mobile1" } },
8788
};
89+
90+
export const WithSwitch: Story = {
91+
render: (props) => (
92+
<ActionGroup {...props}>
93+
<Button slot="secondary">Edit</Button>
94+
<Switch slot="primary">Activate</Switch>
95+
</ActionGroup>
96+
),
97+
};

0 commit comments

Comments
 (0)