-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook: Add ColorPicker component (#18013)
* Add color picker component to Storybook * Switch screen-reader-text to new VisuallyHidden * Update ColorPicker tests snapshots * Add story for showing Alpha Channel * Move state out of exported component * Lowercase story name
- Loading branch information
Showing
5 changed files
with
62 additions
and
22 deletions.
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
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,39 @@ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ColorPicker from '../'; | ||
|
||
export default { title: 'ColorPicker', component: ColorPicker }; | ||
|
||
const ColorPickerWithState = ( { ...props } ) => { | ||
const [ color, setColor ] = useState( '#f00' ); | ||
return ( | ||
<ColorPicker | ||
{ ...props } | ||
color={ color } | ||
onChangeComplete={ ( value ) => setColor( value.hex ) } | ||
/> | ||
); | ||
}; | ||
|
||
export const _default = () => { | ||
return ( | ||
<ColorPickerWithState | ||
disableAlpha | ||
/> | ||
); | ||
}; | ||
|
||
export const alphaEnabled = () => { | ||
return ( | ||
<ColorPickerWithState | ||
disableAlpha={ false } | ||
/> | ||
); | ||
}; |
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