Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 5ce4cfc

Browse files
committed
fix: textarea and select label
1 parent 099206a commit 5ce4cfc

File tree

7 files changed

+46
-35
lines changed

7 files changed

+46
-35
lines changed

@types/cherry.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ interface SelectProps
168168
error?: boolean;
169169
success?: boolean;
170170
size?: "default" | "big";
171+
label?: string;
171172
theme?: object;
172173
}
173174

@@ -177,6 +178,7 @@ interface TextareaProps
177178
error?: boolean;
178179
success?: boolean;
179180
size?: "default" | "big";
181+
label?: string;
180182
theme?: object;
181183
}
182184

dist/cherry.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cherry.module.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cherry-components",
3-
"version": "0.0.1-8",
3+
"version": "0.0.1-9",
44
"description": "Cherry React Components",
55
"main": "dist/cherry.js",
66
"module": "dist/cherry.module.js",

src/Layout/Input/Select/Select.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,39 @@ import React from "react";
22
import { localTheme } from "../../../theme";
33
import { Arrow } from "../../../svg/Arrow";
44
import { selectWrapperStyles, inputStyles } from "../Input.styles";
5+
import { Label } from "../../Label";
56

67
function Select({
78
className,
89
children,
910
size = "default",
1011
error,
1112
success,
13+
label,
1214
theme = localTheme,
1315
...props
1416
}) {
1517
return (
16-
<div css={selectWrapperStyles(theme, size, success, error)}>
17-
<select
18-
className={className}
19-
css={inputStyles(
20-
theme,
21-
"text",
22-
size,
23-
props.disabled,
24-
success,
25-
error,
26-
)}
27-
{...props}
28-
>
29-
{children}
30-
</select>
31-
<Arrow />
32-
</div>
18+
<>
19+
{label && <Label htmlFor={props.id}>{label}</Label>}
20+
<div css={selectWrapperStyles(theme, size, success, error)}>
21+
<select
22+
className={className}
23+
css={inputStyles(
24+
theme,
25+
"text",
26+
size,
27+
props.disabled,
28+
success,
29+
error,
30+
)}
31+
{...props}
32+
>
33+
{children}
34+
</select>
35+
<Arrow />
36+
</div>
37+
</>
3338
);
3439
}
3540

src/Layout/Input/Textarea/Textarea.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
import React from "react";
22
import { localTheme } from "../../../theme";
3-
import { Arrow } from "../../../svg/Arrow";
3+
import { Label } from "../../Label";
44
import { inputStyles } from "../Input.styles";
55

66
function Textarea({
77
className,
88
size = "default",
99
error,
1010
success,
11+
label,
1112
theme = localTheme,
1213
...props
1314
}) {
1415
return (
15-
<textarea
16-
className={className}
17-
css={inputStyles(
18-
theme,
19-
"text",
20-
size,
21-
props.disabled,
22-
success,
23-
error,
24-
)}
25-
{...props}
26-
/>
16+
<>
17+
{label && <Label htmlFor={props.id}>{label}</Label>}
18+
<textarea
19+
className={className}
20+
css={inputStyles(
21+
theme,
22+
"text",
23+
size,
24+
props.disabled,
25+
success,
26+
error,
27+
)}
28+
{...props}
29+
/>
30+
</>
2731
);
2832
}
2933

0 commit comments

Comments
 (0)