Reafactor/UI input and displays (#1544)
* WIP * Text field * URL * Finished PhoneInput * Refactored input sub-folders * Boolean * Fix lint * Fix lint * Fix useOutsideClick --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,16 +0,0 @@
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
const StyledTextInputDisplay = styled.div`
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export type TextInputDisplayProps = {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export function TextInputDisplay({ children }: TextInputDisplayProps) {
|
||||
return <StyledTextInputDisplay>{children}</StyledTextInputDisplay>;
|
||||
}
|
||||
@ -197,4 +197,4 @@ function TextInputComponent(
|
||||
);
|
||||
}
|
||||
|
||||
export const TextInput = forwardRef(TextInputComponent);
|
||||
export const TextInputSettings = forwardRef(TextInputComponent);
|
||||
@ -6,28 +6,28 @@ import { userEvent, within } from '@storybook/testing-library';
|
||||
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { TextInput } from '../TextInput';
|
||||
import { TextInputSettings } from '../TextInputSettings';
|
||||
|
||||
const changeJestFn = jest.fn();
|
||||
|
||||
const meta: Meta<typeof TextInput> = {
|
||||
const meta: Meta<typeof TextInputSettings> = {
|
||||
title: 'UI/Input/TextInput',
|
||||
component: TextInput,
|
||||
component: TextInputSettings,
|
||||
decorators: [ComponentDecorator],
|
||||
args: { value: '', onChange: changeJestFn, placeholder: 'Placeholder' },
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof TextInput>;
|
||||
type Story = StoryObj<typeof TextInputSettings>;
|
||||
|
||||
function FakeTextInput({
|
||||
onChange,
|
||||
value: initialValue,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TextInput>) {
|
||||
}: React.ComponentProps<typeof TextInputSettings>) {
|
||||
const [value, setValue] = useState(initialValue);
|
||||
return (
|
||||
<TextInput
|
||||
<TextInputSettings
|
||||
{...props}
|
||||
value={value}
|
||||
onChange={(text) => {
|
||||
|
||||
Reference in New Issue
Block a user