Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Input refactoring #2592

Merged
merged 10 commits into from
Nov 14, 2024
Merged

Feat: Input refactoring #2592

merged 10 commits into from
Nov 14, 2024

Conversation

tuul-wq
Copy link
Contributor

@tuul-wq tuul-wq commented Nov 7, 2024

  • Updated Input content
  • Moved Inputs to ui-kit
  • Updated related imports and screens

closes #2587

Before:
image

After:
image

@tuul-wq tuul-wq self-assigned this Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 8, 2024

Jest Unit tests results

Generic badge

Duration: 58.552 seconds
Start: 2024-11-14 12:15:30.622 UTC
Finish: 2024-11-14 12:16:29.174 UTC
Duration: 58.552 seconds
Outcome: Passed | Total Tests: 738 | Passed: 737 | Failed: 0
Total Test Suites: 159
Total Tests: 738
Failed Test Suites: 0
Failed Tests: 0
Passed Test Suites: 158
Passed Tests: 737
Pending Test Suites: 1
Pending Tests: 1

@tuul-wq tuul-wq requested a review from johnthecat November 11, 2024 15:27
# Conflicts:
#	src/renderer/widgets/CreateWallet/ui/MultisigWallet/components/Signatory.tsx
@tuul-wq tuul-wq merged commit 37925ea into feat/flexible-multisig Nov 14, 2024
3 checks passed
@tuul-wq tuul-wq deleted the feat/input branch November 14, 2024 12:46
@tuul-wq tuul-wq mentioned this pull request Nov 20, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this test inside storybook play function

@@ -42,9 +42,16 @@ Disabled.args = {
disabled: true,
};

export const Prefix = Template.bind({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use latest story format, please. You can see examples in the other ui-kit components

suffixElement,
onChange,
onPaste,
...props
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@@ -1,4 +1,4 @@
type BaseHTMLInputProps = 'value' | 'required' | 'disabled' | 'placeholder' | 'name' | 'className' | 'autoFocus';
type BaseHTMLInputProps = 'value' | 'required' | 'disabled' | 'placeholder' | 'name' | 'autoFocus';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to move this outside of input props? Overall reading complexity outweighs benefits of shared configuration IMO

useLayoutEffect(() => {
if (!prefixElement || !prefixRef.current) return;

setPaddingLeft(EXTENDED_HORIZONTAL_PADDING + prefixRef.current.getBoundingClientRect().width);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can set ref to top level div element (also, it should be label) and remove all this complex code, made only to support combobox specific api.
Second option - keep ref for input element, but wrap Input into additional div inside Combobox

const LONG_TEXT =
'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa doloribus iusto possimus praesentium ratione temporibus. Aperiam autem cumque esse eum fugit laborum quas! Architecto at, cupiditate dignissimos eveniet sunt voluptatibus.';

export const Primary = Template.bind({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use new story format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this test into storybook play function

import { cnTw } from '@/shared/lib/utils';
import { type HTMLTextAreaProps } from '../common/types';

interface Props extends Pick<ComponentPropsWithoutRef<'textarea'>, HTMLTextAreaProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface?


interface Props extends Pick<ComponentPropsWithoutRef<'textarea'>, HTMLTextAreaProps> {
invalid?: boolean;
onChange?: (value: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why onChange callback is optional? Component should be fully controllable IMO

const DEFAULT_LEFT_PADDING = 11;
const EXTENDED_LEFT_PADDING = 19;

type InputProps = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only name | label | value | onChange are used, maybe you should simplify this component?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants