-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e15fad
commit cef6648
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
packages/block-editor/src/components/font-sizes/stories/index.story.js
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,81 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import FontSizePicker from '../font-size-picker.js'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/FontSizePicker', | ||
component: FontSizePicker, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'Renders a user interface that allows the user to select predefined (common) font sizes.', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
fallbackFontSize: { | ||
control: { type: null }, | ||
description: | ||
'Starting position for the font size picker slider, if active.', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
onChange: { | ||
action: 'onChange', | ||
control: { type: null }, | ||
table: { | ||
type: { summary: 'function' }, | ||
}, | ||
description: 'Function executed when the font size changes.', | ||
}, | ||
value: { | ||
control: { type: 'number' }, | ||
description: 'The current font size value.', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
withSlider: { | ||
control: { type: null }, | ||
description: | ||
'To control the UI to contain a slider or a numeric text input field.', | ||
table: { | ||
type: { | ||
summary: 'boolean', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
render: function Template( { onChange, ...args } ) { | ||
const [ value, setValue ] = useState(); | ||
|
||
return ( | ||
<FontSizePicker | ||
{ ...args } | ||
value={ value } | ||
onChange={ ( ...changeArgs ) => { | ||
onChange( ...changeArgs ); | ||
setValue( ...changeArgs ); | ||
} } | ||
/> | ||
); | ||
}, | ||
}; |