Skip to content

Commit

Permalink
feat(ActionGroup): support switch (#1105)
Browse files Browse the repository at this point in the history
* feat(ActionGroup): support switch

* feat(ActionGroup): support switch
  • Loading branch information
Lisa18289 authored Jan 20, 2025
1 parent 4f7fd92 commit 5415c9d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.actionGroup {
display: flex;
align-items: center;

.primary {
order: 3;

&:only-child {
margin-left: auto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export const ActionGroup = flowComponent("ActionGroup", (props) => {
return clsx(props.className, styles[slot]);
}),
},
Switch: {
labelPosition: "leading",
className: dynamic((props) => {
return clsx(props.className, props.slot && styles[props.slot]);
}),
},
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from "react";
import { Button } from "@/components/Button";
import { Action } from "@/components/Action";
import { sleep } from "@/lib/promises/sleep";
import { Switch } from "@/components/Switch";

const meta: Meta<typeof ActionGroup> = {
title: "Actions/ActionGroup",
Expand Down Expand Up @@ -85,3 +86,12 @@ export const WithExtraSecondaryAction: Story = {
export const Mobile: Story = {
parameters: { viewport: { defaultViewport: "mobile1" } },
};

export const WithSwitch: Story = {
render: (props) => (
<ActionGroup {...props}>
<Button slot="secondary">Edit</Button>
<Switch slot="primary">Activate</Switch>
</ActionGroup>
),
};

0 comments on commit 5415c9d

Please sign in to comment.