Skip to content

Commit

Permalink
refactor(ui): Input - convert to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Jan 9, 2024
1 parent 07b3a48 commit 92f06a4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
File renamed without changes.
20 changes: 0 additions & 20 deletions packages/ui/src/ui/input/input.jsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export default {
};

export const Default = () => <Input placeholder="Search" />;
export const WithSize = () => <Input size="small" placeholder="Search" />;
export const WithSize = () => <Input placeholder="Search" size="small" />;
16 changes: 16 additions & 0 deletions packages/ui/src/ui/input/input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import cx from 'classnames';

import css from './input.module.css';

interface InputProps {
size?: 'small' | 'medium' | 'large';
}

export const Input = (props: InputProps & Omit<React.ComponentProps<'input'>, 'size'>) => {
const { className = '', size = 'medium', ...restProps } = props;

const rootClassName = cx(css.root, className, css[size]);

return <input className={rootClassName} {...restProps} />;
};

0 comments on commit 92f06a4

Please sign in to comment.