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

Commit 6cb75e3

Browse files
committed
feat: button full width
1 parent 1641615 commit 6cb75e3

File tree

8 files changed

+46
-10
lines changed

8 files changed

+46
-10
lines changed

@types/cherry.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4141
variant?: "primary" | "secondary" | "tertiary";
4242
frame?: boolean;
4343
size?: "default" | "big";
44+
fullWidth?: boolean;
4445
theme?: object;
4546
}
4647

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-10",
3+
"version": "0.0.1-11",
44
"description": "Cherry React Components",
55
"main": "dist/cherry.js",
66
"module": "dist/cherry.module.js",

src/Layout/Button/Button.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ function Button({
88
variant = "primary",
99
size = "default",
1010
frame,
11+
fullWidth,
1112
theme = localTheme,
1213
...props
1314
}) {
1415
return (
1516
<button
1617
className={className}
17-
css={buttonStyles(theme, variant, size, frame, props.disabled)}
18+
css={buttonStyles(
19+
theme,
20+
variant,
21+
size,
22+
frame,
23+
props.disabled,
24+
fullWidth,
25+
)}
1826
{...props}
1927
>
2028
{children}

src/Layout/Button/Button.styles.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@ import {
44
buttonFontStyles,
55
resetButtonStyles,
66
} from "../../helperStyles";
7-
import { Breakpoints, mq } from "../../mq";
87

9-
export const buttonStyles = (theme, variant, size, frame, disabled) => css`
8+
export const buttonStyles = (
9+
theme,
10+
variant,
11+
size,
12+
frame,
13+
disabled,
14+
fullWidth,
15+
) => css`
1016
${resetButtonStyles};
1117
display: inline-block;
1218
vertical-align: middle;
1319
font-weight: 600;
1420
padding: 15px 25px;
1521
border-radius: 100px;
1622
23+
${fullWidth &&
24+
css`
25+
width: 100%;
26+
`}
27+
1728
${size === "default"
1829
? css`
1930
${buttonFontStyles(theme)};

src/Layout/Input/Input.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,22 @@ function Input({
3232
{...props}
3333
/>
3434
{type === "checkbox" ? <Check /> : <em />}
35-
{label && <Label htmlFor={props.id}>{label}</Label>}
35+
{label && (
36+
<Label htmlFor={props.id} error={error} success={success}>
37+
{label}
38+
</Label>
39+
)}
3640
</div>
3741
);
3842
}
3943

4044
return (
4145
<>
42-
{label && <Label htmlFor={props.id}>{label}</Label>}
46+
{label && (
47+
<Label htmlFor={props.id} error={error} success={success}>
48+
{label}
49+
</Label>
50+
)}
4351
<input
4452
type={type}
4553
className={className}

src/Layout/Input/Select/Select.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ function Select({
1616
}) {
1717
return (
1818
<>
19-
{label && <Label htmlFor={props.id}>{label}</Label>}
19+
{label && (
20+
<Label htmlFor={props.id} error={error} success={success}>
21+
{label}
22+
</Label>
23+
)}
2024
<div css={selectWrapperStyles(theme, size, success, error)}>
2125
<select
2226
className={className}

src/Layout/Input/Textarea/Textarea.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ function Textarea({
1414
}) {
1515
return (
1616
<>
17-
{label && <Label htmlFor={props.id}>{label}</Label>}
17+
{label && (
18+
<Label htmlFor={props.id} error={error} success={success}>
19+
{label}
20+
</Label>
21+
)}
1822
<textarea
1923
className={className}
2024
css={inputStyles(

0 commit comments

Comments
 (0)