remove UseState from SpectrumPalette story (#52612)

pull/52615/head
Ashley Harrison 3 years ago committed by GitHub
parent 27542445ce
commit c68ae0b616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      packages/grafana-ui/src/components/ColorPicker/SpectrumPalette.story.tsx

@ -1,13 +1,14 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { useArgs } from '@storybook/client-api';
import { Meta, Story } from '@storybook/react';
import { UseState } from '../../utils/storybook/UseState';
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
import { renderComponentWithTheme } from '../../utils/storybook/withTheme';
import mdx from './ColorPicker.mdx';
import SpectrumPalette from './SpectrumPalette';
import SpectrumPalette, { SpectrumPaletteProps } from './SpectrumPalette';
export default {
const meta: Meta = {
title: 'Pickers and Editors/ColorPicker/Palettes/SpectrumPalette',
component: SpectrumPalette,
decorators: [withCenteredStory],
@ -15,15 +16,24 @@ export default {
docs: {
page: mdx,
},
controls: {
exclude: ['onChange'],
},
},
args: {
color: 'red',
},
};
export const simple = () => {
return (
<UseState initialState="red">
{(selectedColor, updateSelectedColor) => {
return renderComponentWithTheme(SpectrumPalette, { color: selectedColor, onChange: updateSelectedColor });
}}
</UseState>
);
export const Simple: Story<SpectrumPaletteProps> = ({ color }) => {
const [, updateArgs] = useArgs();
return renderComponentWithTheme(SpectrumPalette, {
color,
onChange: (color: string) => {
action('Color changed')(color);
updateArgs({ color });
},
});
};
export default meta;

Loading…
Cancel
Save