Skip to content

Commit

Permalink
feat(Tooltip): remove dynamic text story
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbrillant committed Apr 3, 2024
1 parent ec542a1 commit 3e7cab2
Showing 1 changed file with 2 additions and 51 deletions.
53 changes: 2 additions & 51 deletions packages/storybook/stories/tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {
DropdownList,
Tooltip,
TooltipPlacement,
TextInput,
} from '@equisoft/design-elements-react';
import { StoryFn as Story } from '@storybook/react';
import { useState, useCallback } from 'react';
import { useState } from 'react';
import styled from 'styled-components';
import { DesktopDecorator } from './utils/device-context-decorator';
import { rawCodeParameters } from './utils/parameters';
Expand Down Expand Up @@ -133,9 +132,8 @@ export const WithDropdownNavigation: Story = () => {

WithDropdownNavigation.decorators = [RouterDecorator];

const CodeContainer = styled.div<{ justifyContent?: string }>`
const CodeContainer = styled.div`
display: flex;
justify-content: ${({ justifyContent }) => (justifyContent || 'flex-start')};
`;
export const WithConfirmation: Story = () => {
const code = 'JBSW Y3DP EHPK 3PXP';
Expand Down Expand Up @@ -163,50 +161,3 @@ export const WithConfirmation: Story = () => {
</Container>
);
};

export const WithDynamicText: Story = () => {
const [label, setLabel] = useState<string>('Hide password');
const [iconName, setIconName] = useState<'eye' | 'eyeOff'>('eye');
const [inputType, setInputType] = useState<string>('password');
const [password, setPassword] = useState<string>('somePassword');
const handleOnClick = useCallback(() => {
if (label === 'Hide password') {
setLabel('Show password in plain text');
setIconName('eyeOff');
setInputType('password');
} else {
setLabel('Hide password');
setIconName('eye');
setInputType('text');
}
}, [label, setLabel]);
const handleOnPasswordChange = useCallback((newPassword) => {
setPassword(newPassword);
}, [setPassword]);

return (
<Container>
<CodeContainer justifyContent='flex-end'>
<TextInput
required
label="Password"
type={inputType}
value={password}
onChange={handleOnPasswordChange}
validationErrorMessage="This field is required"
/>
<Tooltip
label={label}
desktopPlacement="top"
defaultOpen
>
<IconButton
buttonType='primary'
onClick={handleOnClick}
iconName={iconName}
/>
</Tooltip>
</CodeContainer>
</Container>
);
};

0 comments on commit 3e7cab2

Please sign in to comment.