@omniumretail/component-library 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import {
|
|
2
|
+
import { Radio as RadioAntd, RadioChangeEvent } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Radio, CustomRadioProps } from '.';
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
7
|
title: 'Radio',
|
|
6
|
-
component:
|
|
8
|
+
component: Radio,
|
|
7
9
|
} as Meta;
|
|
8
10
|
|
|
9
|
-
const Template: Story<CustomRadioProps> = (args) =>
|
|
11
|
+
const Template: Story<CustomRadioProps> = (args) => {
|
|
12
|
+
const [value, setValue] = useState();
|
|
13
|
+
|
|
14
|
+
const onChange = (e: RadioChangeEvent) => {
|
|
15
|
+
console.log('radio checked', e.target.value);
|
|
16
|
+
setValue(e.target.value);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<RadioAntd.Group onChange={onChange} value={value} defaultValue={3}>
|
|
21
|
+
<Radio {...args} value={1}></Radio>
|
|
22
|
+
<Radio {...args} value={2}></Radio>
|
|
23
|
+
<Radio {...args} value={3}></Radio>
|
|
24
|
+
<Radio {...args} value={4}></Radio>
|
|
25
|
+
</RadioAntd.Group>
|
|
26
|
+
)
|
|
27
|
+
};
|
|
10
28
|
|
|
11
29
|
export const Primary = Template.bind({});
|
|
12
30
|
Primary.args = {
|
|
@@ -6,10 +6,9 @@ export interface CustomRadioProps extends RadioProps {
|
|
|
6
6
|
description: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const
|
|
10
|
-
const { description } = props;
|
|
9
|
+
export const Radio = ({description, ...radioProps}: CustomRadioProps) => {
|
|
11
10
|
|
|
12
11
|
return (
|
|
13
|
-
<RadioAntd className={ styles.radio } { ...
|
|
12
|
+
<RadioAntd className={ styles.radio } { ...radioProps }> { description } </RadioAntd>
|
|
14
13
|
)
|
|
15
14
|
};
|