import React from 'react'; import { useMeasure } from 'react-use'; import { ComponentMeta, ComponentStory } from '@storybook/react'; import { Box } from '../Layout'; import { PasswordInput } from './Input'; export default { title: 'UI Components/PasswordInput', component: PasswordInput.Root, argTypes: { css: { control: 'object' }, }, } as ComponentMeta; //👇 We create a “template” of how args map to rendering const Template: ComponentStory = args => { const [text, setText] = React.useState(''); const [showPassword, setShowPassword] = React.useState(false); const [ref, { width }] = useMeasure(); return ( setText(e.target.value)} /> { setShowPassword(!showPassword); }} css={{ color: '$on_primary_high', }} /> { navigator.clipboard.writeText(text); }} css={{ color: '$on_primary_high', }} /> ); }; export const Example = Template.bind({}); Example.storyName = 'PasswordInput';