Skip to content

Commit 5603059

Browse files
authored
fix(datepicker): pass error prop to Form.Field (#708)
* chore: revert eslint-plugin-prettier to v3 * chore: add error knob to Storybook * fix(datepicker): pass error prop to Form.Field
1 parent f0c1707 commit 5603059

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"babel-jest": "27.4.5",
5757
"babel-loader": "8.2.3",
5858
"cssnano": "4.1.11",
59-
"eslint-plugin-prettier": "4.0.0",
59+
"eslint-plugin-prettier": "3.4.1",
6060
"husky": "7.0.4",
6161
"jest-transform-css": "3.0.0",
6262
"prettier": "2.5.1",

src/components/input.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const inputData = {
1616
const CustomInput = React.forwardRef<Input, InputProps>((props, ref) => {
1717
const {
1818
clearIcon,
19+
error,
1920
icon,
2021
isClearIconVisible,
2122
label,
@@ -27,11 +28,12 @@ const CustomInput = React.forwardRef<Input, InputProps>((props, ref) => {
2728
} = props;
2829

2930
return (
30-
<Form.Field required={required}>
31+
<Form.Field error={error} required={required}>
3132
{label && <label htmlFor={rest.id as string | undefined}>{label}</label>}
3233
<Input
3334
{...rest}
3435
ref={ref}
36+
error={error}
3537
required={required}
3638
icon={
3739
<CustomIcon

stories/index.stories.tsx

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,31 @@ export const withCustomIcons = () => {
109109
);
110110
};
111111

112-
export const usageWithForm = () => (
113-
<Content>
114-
<Form>
115-
<Form.Group width="equals">
116-
<SemanticDatepicker
117-
label="Initial date"
118-
id="initialDate"
119-
onChange={onChange}
120-
required
121-
/>
122-
<SemanticDatepicker
123-
label="Final date"
124-
id="finalDate"
125-
onChange={onChange}
126-
/>
127-
</Form.Group>
128-
</Form>
129-
</Content>
130-
);
112+
export const usageWithForm = () => {
113+
const error = boolean('Error state', false);
114+
115+
return (
116+
<Content>
117+
<Form>
118+
<Form.Group width="equals">
119+
<SemanticDatepicker
120+
error={error}
121+
label="Initial date"
122+
id="initialDate"
123+
onChange={onChange}
124+
required
125+
/>
126+
<SemanticDatepicker
127+
error={error}
128+
label="Final date"
129+
id="finalDate"
130+
onChange={onChange}
131+
/>
132+
</Form.Group>
133+
</Form>
134+
</Content>
135+
);
136+
};
131137

132138
export const inverted = () => {
133139
const type = select('Type', typeMap, typeMap.basic);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5946,10 +5946,10 @@ eslint-plugin-jsx-a11y@^6.2.3:
59465946
has "^1.0.3"
59475947
jsx-ast-utils "^2.2.1"
59485948

5949-
eslint-plugin-prettier@4.0.0:
5950-
version "4.0.0"
5951-
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz#8b99d1e4b8b24a762472b4567992023619cb98e0"
5952-
integrity sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==
5949+
eslint-plugin-prettier@3.4.1:
5950+
version "3.4.1"
5951+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5"
5952+
integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==
59535953
dependencies:
59545954
prettier-linter-helpers "^1.0.0"
59555955

0 commit comments

Comments
 (0)