-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: wrap radio group and button components (#282)
- Loading branch information
1 parent
3eeaaf2
commit 6e67439
Showing
5 changed files
with
97 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { type Meta, type StoryObj } from '@storybook/react' | ||
import { Radio } from 'src/components/data-entry/Radio/Radio' | ||
|
||
const meta: Meta<typeof Radio.Button> = { | ||
title: 'Aquarium/Data Entry/Radio/RadioButton', | ||
component: Radio.Button, | ||
|
||
args: { | ||
autoFocus: false, | ||
checked: false, | ||
defaultChecked: false, | ||
disabled: false, | ||
value: undefined, | ||
children: 'Radio Button', | ||
}, | ||
} | ||
export default meta | ||
|
||
type Story = StoryObj<typeof Radio.Button> | ||
|
||
export const Primary: Story = {} |
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,13 @@ | ||
import { Radio as AntRadio } from 'antd' | ||
import { type RadioButtonProps as AntRadioGroupProps } from "antd/es/radio/radioButton"; | ||
import { ConfigProvider } from 'src/components' | ||
|
||
export interface IRadioButtonProps extends AntRadioGroupProps {} | ||
|
||
export const RadioButton = (props: IRadioButtonProps) => { | ||
return ( | ||
<ConfigProvider> | ||
<AntRadio.Button {...props} /> | ||
</ConfigProvider> | ||
) | ||
} |
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,46 @@ | ||
import { type Meta, type StoryObj } from '@storybook/react' | ||
import { Radio } from 'src/components/data-entry/Radio/Radio' | ||
|
||
const meta: Meta<typeof Radio.Group> = { | ||
title: 'Aquarium/Data Entry/Radio/RadioGroup', | ||
component: Radio.Group, | ||
|
||
args: { | ||
buttonStyle: undefined, | ||
defaultValue: undefined, | ||
disabled: false, | ||
name: undefined, | ||
options: undefined, | ||
optionType: undefined, | ||
size: 'middle', | ||
value: undefined, | ||
onChange: undefined, | ||
children: undefined | ||
}, | ||
} | ||
export default meta | ||
|
||
type Story = StoryObj<typeof Radio.Group> | ||
|
||
export const WithOptionsAndOptionType: Story = { | ||
args: { | ||
options: [ | ||
{ label: 'Apple', value: 'Apple' }, | ||
{ label: 'Pear', value: 'Pear' }, | ||
{ label: 'Orange', value: 'Orange', title: 'Orange' }, | ||
], | ||
optionType: 'default', | ||
}, | ||
} | ||
|
||
export const WithRadioButtons: Story = { | ||
args: { | ||
defaultValue: "a", | ||
children: [ | ||
<Radio.Button value="a">Hangzhou</Radio.Button>, | ||
<Radio.Button value="b">Shanghai</Radio.Button>, | ||
<Radio.Button value="c">Beijing</Radio.Button>, | ||
<Radio.Button value="d">Chengdu</Radio.Button> | ||
] | ||
}, | ||
} |
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,13 @@ | ||
import { Radio as AntRadio } from 'antd' | ||
import { type RadioGroupProps as AntRadioGroupProps } from 'antd' | ||
import { ConfigProvider } from 'src/components' | ||
|
||
export interface IRadioGroupProps extends AntRadioGroupProps {} | ||
|
||
export const RadioGroup = (props: IRadioGroupProps) => { | ||
return ( | ||
<ConfigProvider> | ||
<AntRadio.Group {...props} /> | ||
</ConfigProvider> | ||
) | ||
} |