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

Commit 42a3757

Browse files
committed
feat: add radio-check-wrapper, fix label wrapping for checkboxes and radios and improve full-width property
1 parent 4bf6749 commit 42a3757

File tree

10 files changed

+334
-372
lines changed

10 files changed

+334
-372
lines changed

@types/cherry.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ interface LabelProps extends React.InputHTMLAttributes<HTMLLabelElement> {
190190
children?: React.ReactNode;
191191
error?: boolean;
192192
success?: boolean;
193+
fullWidth?: boolean;
193194
htmlFor?: string;
194195
theme?: object;
195196
}

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: 312 additions & 362 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-16",
3+
"version": "0.0.2",
44
"description": "Cherry React Components",
55
"main": "dist/cherry.js",
66
"module": "dist/cherry.module.js",

src/Layout/Input/Input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Input({
1212
success,
1313
error,
1414
label,
15-
fullWidth = true,
15+
fullWidth,
1616
theme = localTheme,
1717
...props
1818
}) {

src/Layout/Input/Select/Select.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ function Select({
1212
success,
1313
label,
1414
theme = localTheme,
15-
fullWidth = true,
15+
fullWidth,
1616
...props
1717
}) {
1818
return (
1919
<>
2020
{label && (
21-
<Label htmlFor={props.id} error={error} success={success}>
21+
<Label
22+
htmlFor={props.id}
23+
error={error}
24+
success={success}
25+
fullWidth={fullWidth}
26+
>
2227
{label}
2328
</Label>
2429
)}

src/Layout/Input/Textarea/Textarea.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Textarea({
1010
success,
1111
label,
1212
theme = localTheme,
13-
fullWidth = true,
13+
fullWidth,
1414
...props
1515
}) {
1616
return (

src/Layout/Label/Label.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ function Label({
77
children,
88
error,
99
success,
10+
fullWidth,
1011
htmlFor,
1112
theme = localTheme,
1213
...props
1314
}) {
1415
return (
1516
<label
1617
className={className}
17-
css={labelStyles(theme, error, success)}
18+
css={labelStyles(theme, error, success, fullWidth)}
1819
htmlFor={htmlFor}
1920
{...props}
2021
>

src/Layout/Label/Label.styles.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { css } from "@emotion/react";
22
import { Breakpoints, mq } from "../../mq";
33

4-
export const labelStyles = (theme, error, success) => css`
4+
export const labelStyles = (theme, error, success, fullWidth) => css`
55
color: ${theme.colors.gray};
66
display: inline-block;
77
vertical-align: middle;
8-
padding: 0;
8+
padding: 0 7px 0 0;
99
margin: 0;
1010
line-height: ${theme.sizes.text.lineheight.mobile};
1111
12+
${fullWidth &&
13+
css`
14+
width: 100%;
15+
`}
16+
1217
${mq(Breakpoints.lg)} {
1318
line-height: ${theme.sizes.text.lineheight.desktop};
1419
}

0 commit comments

Comments
 (0)