mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Update story for NamedColorsPalette
This commit is contained in:
parent
d414e463bd
commit
1e69a7b8b7
@ -1,6 +1,6 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import NamedColorsPalette from './NamedColorsPalette';
|
||||
import { NamedColorsPalette } from './NamedColorsPalette';
|
||||
import { getColorName } from '../../utils/namedColorsPalette';
|
||||
import { withKnobs, select } from '@storybook/addon-knobs';
|
||||
|
||||
@ -35,7 +35,7 @@ export class UseState<T> extends React.Component<StateHolderProps<T>, { value: T
|
||||
static getDerivedStateFromProps(props: StateHolderProps<{}>, state: { value: {} }) {
|
||||
return {
|
||||
value: props.initialState,
|
||||
...state
|
||||
...state,
|
||||
};
|
||||
}
|
||||
|
||||
@ -64,12 +64,7 @@ storiesOf('UI/NamedColorsPalette', module)
|
||||
return (
|
||||
<UseState initialState={selectedColor}>
|
||||
{(selectedColor, updateSelectedColor) => {
|
||||
return (
|
||||
<NamedColorsPalette
|
||||
color={selectedColor}
|
||||
onChange={updateSelectedColor}
|
||||
/>
|
||||
);
|
||||
return <NamedColorsPalette color={selectedColor} onChange={updateSelectedColor} />;
|
||||
}}
|
||||
</UseState>
|
||||
);
|
||||
@ -78,12 +73,7 @@ storiesOf('UI/NamedColorsPalette', module)
|
||||
return (
|
||||
<UseState initialState="#00ff00">
|
||||
{(selectedColor, updateSelectedColor) => {
|
||||
return (
|
||||
<NamedColorsPalette
|
||||
color={getColorName(selectedColor)}
|
||||
onChange={updateSelectedColor}
|
||||
/>
|
||||
);
|
||||
return <NamedColorsPalette color={getColorName(selectedColor)} onChange={updateSelectedColor} />;
|
||||
}}
|
||||
</UseState>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user