Skip to content

Commit

Permalink
chore: Create a story for UnitInput component (#25225)
Browse files Browse the repository at this point in the history
## **Description**

This pull request adds a Storybook story for the `UnitInput` component.
The story renders the `UnitInput` component with several configurable
properties, allowing users to interact with and test the component in
isolation. The story adheres to the project's standards and provides a
clear example of how the `UnitInput` component can be used.

## **Related issues**

## **Manual testing steps**

- Go to the latest build of storybook in this PR
- Navigate to the UnitInput component in the Components/UI folder.

## **Screenshots/Recordings**


![25b39d33-9c39-40ba-a069-4fea28f1c58f](https://github.com/Devin-Applications/metamask-extension-devin/assets/168687171/556acccc-5c5b-4b6c-98a6-84060e19accb)

## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've completed the PR template to the best of my ability
- [X] I’ve included tests if applicable
- [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

[Devin
Run](https://preview.devin.ai/devin/de2457c56b42469f836e510b6d0b11fc)

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
  • Loading branch information
Devin-Apps and devin-ai-integration[bot] authored Jun 26, 2024
1 parent 4e2596f commit 7e60c9a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions ui/components/ui/unit-input/unit-input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import UnitInput from './unit-input.component';

const meta: Meta<typeof UnitInput> = {
title: 'Components/UI/UnitInput',
component: UnitInput,
argTypes: {
className: { control: 'text' },
dataTestId: { control: 'text' },
children: { control: 'text' },
actionComponent: { control: 'text' },
error: { control: 'boolean' },
onChange: { action: 'changed' },
onBlur: { action: 'blurred' },
placeholder: { control: 'text' },
suffix: { control: 'text' },
hideSuffix: { control: 'boolean' },
value: { control: 'text' },
keyPressRegex: { control: 'text' },
isDisabled: { control: 'boolean' },
isFocusOnInput: { control: 'boolean' },
},
args: {
className: '',
dataTestId: 'unit-input',
children: '',
actionComponent: '',
error: false,
placeholder: '0',
suffix: 'ETH',
hideSuffix: false,
value: '',
keyPressRegex: /^\d*(\.|,)?\d*$/u,
isDisabled: false,
isFocusOnInput: false,
},
};

export default meta;
type Story = StoryObj<typeof UnitInput>;

export const Default: Story = {};

0 comments on commit 7e60c9a

Please sign in to comment.