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

fix: input type issue + added iconStart + date stories + tweaked some paddings #1574

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/TextInput/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ForwardedRef, forwardRef } from 'react';
import { Textbox, TextboxProps } from '@utrecht/component-library-react';
import { Textbox as PRATextbox } from '@persoonlijke-regelingen-assistent/components-react';
import './index.scss';

interface TextInputProps extends TextboxProps {
Expand All @@ -13,7 +14,7 @@ const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttri
return (
<label className="pra-textbox" ref={ref} htmlFor={id}>
{iconStart && <span className="pra-icon pra-icon-start">{iconStart}</span>}
<Textbox {...otherProps} placeholder={placeholder} type="text" id={id} />
<Textbox {...otherProps} placeholder={placeholder} id={id} />
{iconEnd && <span className="pra-icon pra-icon-end">{iconEnd}</span>}
</label>
);
Expand All @@ -22,5 +23,5 @@ const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttri

TextInput.displayName = 'Textbox';

export { TextInput, TextInputProps };
export { TextInput, TextInputProps, PRATextbox };
export default TextInput;
8 changes: 4 additions & 4 deletions components/TextInput/src/pra-textbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
}
}
&-start {
padding-inline-start: calc(var(--utrecht-textbox-padding-inline-start) / 2);
padding-inline-start: calc(var(--utrecht-textbox-padding-inline-start));
}
&-end {
margin-inline-start: auto;
padding-inline-end: calc(var(--utrecht-textbox-padding-inline-end) / 2);
padding-inline-end: calc(var(--utrecht-textbox-padding-inline-end));
}
}

Expand All @@ -46,13 +46,13 @@
&:has(.pra-icon-start) .utrecht-textbox {
border-end-start-radius: 0;
border-start-start-radius: 0;
padding-inline-start: calc(var(--utrecht-textbox-padding-inline-start) / 2);
padding-inline-start: var(--utrecht-textbox-padding-inline-start);
}

&:has(.pra-icon-end) .utrecht-textbox {
border-end-end-radius: 0;
border-start-end-radius: 0;
padding-inline-end: calc(var(--utrecht-textbox-padding-inline-end) / 2);
padding-inline-end: var(--utrecht-textbox-padding-inline-end);
}

&:focus-within {
Expand Down
18 changes: 17 additions & 1 deletion packages/storybook/src/css/TextInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Meta, StoryObj } from '@storybook/react';
import { TextInput } from '@gemeente-denhaag/text-input';
import readme from '../../../../components/TextInput/README.md?raw';
import { SearchIcon } from '@gemeente-denhaag/icons';
import { CallIcon, SearchIcon } from '@gemeente-denhaag/icons';

const meta = {
title: 'CSS/Input/TextInput',
Expand Down Expand Up @@ -31,6 +31,22 @@ export const Invalid: Story = {
args: { ...Default.args, invalid: true },
};

export const Date: Story = {
args: { ...Default.args, type: 'date' },
};

export const Number: Story = {
args: { ...Default.args, type: 'number' },
};

export const Password: Story = {
args: { ...Default.args, type: 'password' },
};

export const WithIconEnd: Story = {
args: { ...Default.args, iconEnd: <SearchIcon /> },
};

export const WithIconStart: Story = {
args: { ...Default.args, iconStart: <CallIcon /> },
};
18 changes: 17 additions & 1 deletion packages/storybook/src/react/TextInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Meta, StoryObj } from '@storybook/react';
import { TextInput } from '@gemeente-denhaag/text-input';
import readme from '../../../../components/TextInput/README.md?raw';
import { SearchIcon } from '@gemeente-denhaag/icons';
import { CallIcon, SearchIcon } from '@gemeente-denhaag/icons';

const meta = {
title: 'React/Input/TextInput',
Expand Down Expand Up @@ -31,6 +31,22 @@ export const Invalid: Story = {
args: { ...Default.args, invalid: true },
};

export const Date: Story = {
args: { ...Default.args, type: 'date' },
};

export const Number: Story = {
args: { ...Default.args, type: 'number' },
};

export const Password: Story = {
args: { ...Default.args, type: 'password' },
};

export const WithIconEnd: Story = {
args: { ...Default.args, iconEnd: <SearchIcon /> },
};

export const WithIconStart: Story = {
args: { ...Default.args, iconStart: <CallIcon /> },
};
4 changes: 2 additions & 2 deletions proprietary/Components/src/utrecht/text-input.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"max-inline-size": {},
"padding-block-end": {},
"padding-block-start": {},
"padding-inline-end": { "value": "24px" },
"padding-inline-start": {},
"padding-inline-end": { "value": "12px" },
"padding-inline-start": { "value": "12px" },
"placeholder": {
"color": {}
},
Expand Down
Loading