-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: wrap radio group and button components #282
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cc34ee4
add RadioButton
gmarques-mParticle a6b3d89
add RadioGroup
gmarques-mParticle 9f5c32c
Change Radio to use aquarium Group and button
gmarques-mParticle a16b263
Merge branch 'main' of https://github.com/mParticle/aquarium into fea…
gmarques-mParticle b1cec93
Merge branch 'main' into feat/wrap-radio-group-and-button
gabrielmarquesf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've noticed that as well. I'm not 100% sure but Input.tsx might help here. We used some inspiration code from Antd's codebase there to be able to properly type the
ref
prop. Not sure how long you'd like to spend on that though, so I'm approving the PR without it. Let me know if you need another approval.