From 76731971e2267809592ad9687c48c2f6481ac8f8 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 14 Dec 2022 04:20:27 +0900 Subject: [PATCH] ToolTip: Remove knobs in stories --- .../components/src/tooltip/stories/index.js | 146 ++++++++---------- 1 file changed, 68 insertions(+), 78 deletions(-) diff --git a/packages/components/src/tooltip/stories/index.js b/packages/components/src/tooltip/stories/index.js index a76b69731b41a..dc573a189bf93 100644 --- a/packages/components/src/tooltip/stories/index.js +++ b/packages/components/src/tooltip/stories/index.js @@ -1,14 +1,3 @@ -/** - * External dependencies - */ -import styled from '@emotion/styled'; -import { text, select, number } from '@storybook/addon-knobs'; - -/** - * WordPress dependencies - */ -import { useState } from '@wordpress/element'; - /** * Internal dependencies */ @@ -17,79 +6,80 @@ import Tooltip from '../'; export default { title: 'Components/ToolTip', component: Tooltip, + argTypes: { + delay: { control: 'number' }, + position: { + control: { + type: 'select', + options: [ + 'top left', + 'top center', + 'top right', + 'bottom left', + 'bottom center', + 'bottom right', + ], + }, + }, + text: { control: 'text' }, + }, parameters: { - knobs: { disable: false }, + docs: { source: { state: 'open' } }, }, }; -export const _default = () => { - const positionOptions = { - 'top left': 'top left', - 'top center ': 'top center', - 'top right': 'top right', - 'bottom left': 'bottom left', - 'bottom center ': 'bottom center', - 'bottom right': 'bottom right', - }; - const tooltipText = text( 'Text', 'More information' ); - const position = select( 'Position', positionOptions, 'top center' ); - const delay = number( 'Delay', 700 ); - return ( - <> - -
- Hover for more information -
-
- -
- Small target -
-
- - ); +const Template = ( args ) => { + return ; }; -const Button = styled.button` - margin: 0 10px; -`; +export const Default = Template.bind( {} ); +Default.args = { + text: 'More information', + children: ( +
+ Hover for more information +
+ ), +}; -export const DisabledElement = () => { - const [ showMessage, toggleMessage ] = useState( false ); +export const SmallTarget = Template.bind( {} ); +SmallTarget.args = { + ...Default.args, + children: ( +
+ Small target +
+ ), +}; - return ( - <> - - - - - - -
- { showMessage ?

Hello World!

: null } - - ); +export const DisabledChild = Template.bind( {} ); +DisabledChild.args = { + ...Default.args, + children: ( + + ), };