-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add ActionButtonGroup and ToggleButtonGroup to example apps an…
…d tailwind starter kit (#7407) * Add ActionButtonGroup and ToggleButtonGroup to S2 example apps * Add ToggleButtonGroup to RAC Tailwind starter kit * enable verdaccio build * Fix TS * Revert "enable verdaccio build" This reverts commit 3f1ee42.
- Loading branch information
1 parent
65e3a52
commit 16153ed
Showing
6 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { composeRenderProps, ToggleButtonGroup as RACToggleButtonGroup, ToggleButtonGroupProps } from 'react-aria-components'; | ||
import { tv } from 'tailwind-variants'; | ||
|
||
const styles = tv({ | ||
base: 'flex gap-1', | ||
variants: { | ||
orientation: { | ||
horizontal: 'flex-row', | ||
vertical: 'flex-col' | ||
} | ||
} | ||
}); | ||
|
||
export function ToggleButtonGroup(props: ToggleButtonGroupProps) { | ||
return ( | ||
<RACToggleButtonGroup | ||
{...props} | ||
className={composeRenderProps(props.className, (className) => styles({orientation: props.orientation || 'horizontal', className}))} /> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Meta } from '@storybook/react'; | ||
import React from 'react'; | ||
import { ToggleButton } from '../src/ToggleButton'; | ||
import { ToggleButtonGroup } from '../src/ToggleButtonGroup'; | ||
import { Bold, Italic, Underline } from 'lucide-react' | ||
|
||
const meta: Meta<typeof ToggleButtonGroup> = { | ||
component: ToggleButtonGroup, | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
tags: ['autodocs'] | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Example = (args: any) => ( | ||
<ToggleButtonGroup {...args}> | ||
<ToggleButton id="bold" aria-label="Bold"><Bold className="w-4 h-4" /></ToggleButton> | ||
<ToggleButton id="italic" aria-label="Italic"><Italic className="w-4 h-4" /></ToggleButton> | ||
<ToggleButton id="underline" aria-label="Underline"><Underline className="w-4 h-4" /></ToggleButton> | ||
</ToggleButtonGroup> | ||
); | ||
|
||
Example.args = { | ||
selectionMode: 'multiple' | ||
}; |