Migrate Checkbox story to tsx - see #18100 (#18101)

Looks good!
This commit is contained in:
Adam Dobrawy 2022-01-20 15:33:45 +01:00 committed by GitHub
parent 5ce79ff856
commit c3a17a7228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@
*/
import React from 'react';
import { useArgs } from '@storybook/client-api';
import Checkbox from '.';
import Checkbox, { CheckboxProps } from '.';
export default {
title: 'Checkbox',
@ -42,9 +42,8 @@ export const CheckboxGallery = () =>
</div>
));
// eslint-disable-next-line no-unused-vars
export const InteractiveCheckbox = _args => {
const [{ checked, style }, updateArgs] = useArgs();
export const InteractiveCheckbox = ({ checked, style }: CheckboxProps) => {
const [, updateArgs] = useArgs();
const toggleCheckbox = () => {
updateArgs({ checked: !checked });
};

View File

@ -49,3 +49,5 @@ export default function Checkbox({ checked, onChange, style }: CheckboxProps) {
</Styles>
);
}
export type { CheckboxProps };

View File

@ -16,5 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
export { default } from 'src/components/Checkbox/Checkbox';
export { default, CheckboxProps } from 'src/components/Checkbox/Checkbox';
export * from 'src/components/Checkbox/CheckboxIcons';