Skip to content

Commit 1e35ca7

Browse files
authored
Add visual design tweaks (#8)
* Add visual design tweaks for window styles * Fix typo in pre-commit hook * Refine form element visual design: - Spacing, sizing and contrast - Colours and animations * Add small visual changes to Copy button
1 parent 5c44039 commit 1e35ca7

File tree

11 files changed

+99
-70
lines changed

11 files changed

+99
-70
lines changed

Taskfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function task:pre-commit { ## Clean up code before committing
103103
task:prettier
104104
task:eslint
105105
task:typescript
106-
title "Comitting"
106+
title "Committing"
107107
}
108108

109109
# =========================================================

src/app/globals.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ body {
1919
pre {
2020
tab-size: 4;
2121
font-family: var(--font-code), monospace;
22+
font-size: 0.94rem;
2223
}
2324

2425
a {

src/components/Form/Checkbox/Checkbox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ type Props = {
1111
options?: RegisterOptions;
1212
};
1313

14-
const RadioInput = ({ name, children, options }: Props): ReactElement => {
14+
const CheckboxInput = ({ name, children, options }: Props): ReactElement => {
1515
const { register } = useFormContext();
1616

1717
return (
1818
<>
1919
<label className={styles.checkbox}>
2020
<input {...register(name, options)} name={name} type="checkbox" />
21-
<span>{children}</span>
21+
<span className={styles.label}>{children}</span>
2222
</label>
2323
<FormError name={name} />
2424
</>
2525
);
2626
};
2727

28-
export default RadioInput;
28+
export default CheckboxInput;
Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.checkbox {
22
position: relative;
3-
font-size: 1.1rem;
3+
font-size: 1rem;
44
}
55

66
.checkbox input {
@@ -13,11 +13,11 @@
1313
.checkbox span {
1414
position: relative;
1515
display: block;
16-
padding: 0.3rem 0.5rem 0.3rem 2rem;
16+
padding: 0.5rem 0.5rem 0.5rem 2rem;
1717
background-color: #f0f0f0;
18-
border-radius: 0.1rem;
18+
border-radius: 0.4rem;
1919
cursor: pointer;
20-
transition: background-color 500ms;
20+
transition: background-color 300ms ease-in-out;
2121
}
2222

2323
.checkbox span:hover {
@@ -27,14 +27,28 @@
2727
.checkbox span::before {
2828
content: '';
2929
background-color: #fff;
30-
width: 20px;
31-
height: 20px;
30+
width: 18px;
31+
height: 18px;
3232
position: absolute;
3333
top: 50%;
34-
left: 5px;
34+
left: 0.4rem;
3535
transform: translateY(-50%);
36+
border-radius: 0.2rem;
37+
transition: background-color 300ms ease-in-out;
38+
}
39+
40+
.checkbox span::after {
41+
content: '';
42+
width: 12px;
43+
height: 12px;
44+
position: absolute;
45+
top: 50%;
46+
left: 9px;
47+
transform: translateY(-50%) scale(0.5);
3648
border-radius: 0.1rem;
37-
transition: background-color 250ms;
49+
transition:
50+
background-color 150ms ease-in-out,
51+
transform 150ms ease-in-out;
3852
}
3953

4054
.checkbox input:focus + span,
@@ -43,13 +57,10 @@
4357
}
4458

4559
.checkbox input:checked + span::after {
46-
content: '';
4760
background-color: #2ac93f;
48-
width: 14px;
49-
height: 14px;
50-
position: absolute;
51-
top: 50%;
52-
left: 8px;
53-
transform: translateY(-50%);
54-
border-radius: 0.1rem;
61+
transform: translateY(-50%) scale(1);
62+
}
63+
64+
.label {
65+
user-select: none;
5566
}

src/components/Form/Radio/Radio.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const RadioInput = ({ name, title, options, choices, flat = false }: Props): Rea
2222
const { register } = useFormContext();
2323

2424
return (
25-
<div className={styles.container}>
26-
<span>{title}</span>
25+
<div>
26+
<span className={styles.title}>{title}</span>
2727
<div className={`${styles.options} ${flat && styles.flat}`}>
2828
{choices.map((radio) => (
2929
<label key={radio.value}>

src/components/Form/Radio/radio.module.css

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
flex-direction: column;
1010
}
1111

12+
.title {
13+
font-weight: 600;
14+
display: inline-block;
15+
margin-bottom: 0.4rem;
16+
}
17+
1218
.option {
13-
font-size: 1.1rem;
19+
font-size: 1rem;
20+
user-select: none;
1421
}
1522

1623
.option input {
@@ -23,11 +30,11 @@
2330
.option span {
2431
position: relative;
2532
display: block;
26-
padding: 0.3rem 0.5rem 0.3rem 2rem;
33+
padding: 0.5rem 1rem 0.5rem 2rem;
2734
background-color: #f0f0f0;
28-
border-radius: 0.2rem;
35+
border-radius: 0.4rem;
2936
cursor: pointer;
30-
transition: background-color 500ms;
37+
transition: background-color 300ms ease-in-out;
3138
}
3239

3340
.option span:hover {
@@ -46,19 +53,30 @@
4653
border-radius: 50%;
4754
}
4855

56+
.option span::after {
57+
content: '';
58+
width: 0.75rem;
59+
height: 0.75rem;
60+
position: absolute;
61+
top: 50%;
62+
left: 0.6rem;
63+
transform: translateY(-50%) scale(0.5);
64+
border-radius: 50%;
65+
transition:
66+
background-color 150ms ease-in-out,
67+
transform 150ms ease-in-out;
68+
}
69+
4970
.option input:focus + span,
5071
.option input:active + span {
5172
outline: 0.2rem solid #a1e1aa;
5273
}
5374

75+
.option input:checked + span {
76+
background: #a1e1aa76;
77+
}
78+
5479
.option input:checked + span::after {
55-
content: '';
5680
background-color: #2ac93f;
57-
width: 0.8rem;
58-
height: 0.8rem;
59-
position: absolute;
60-
top: 50%;
61-
left: 0.6rem;
62-
transform: translateY(-50%);
63-
border-radius: 50%;
81+
transform: translateY(-50%) scale(1);
6482
}

src/components/Form/form.module.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
display: block;
99
}
1010

11+
.title {
12+
font-weight: 600;
13+
display: inline-block;
14+
margin-bottom: 0.4rem;
15+
}
16+
1117
.input {
1218
display: block;
1319
position: relative;
@@ -16,7 +22,7 @@
1622
border-radius: 0.2rem;
1723
border: 0;
1824
width: 100%;
19-
font-size: 1.1rem;
25+
font-size: 1rem;
2026
font-family: var(--font-text), sans-serif;
2127
}
2228

@@ -27,5 +33,7 @@
2733

2834
.error {
2935
display: block;
30-
color: #d00000;
36+
font-size: 1rem;
37+
color: #b43232;
38+
margin-top: 0.4rem;
3139
}

src/components/Generator/GeneredTaskfile/Copy/Copy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const CopyToClipboard = ({ onCopy }: CopyProps): ReactElement => {
2020

2121
return (
2222
<button type="button" className={`${styles.button} ${isCopied && styles.copied}`} onClick={onClick}>
23-
{isCopied ? 'copied!' : 'copy'}
23+
{isCopied ? 'Copied!' : 'Copy'}
2424
</button>
2525
);
2626
};

src/components/Generator/GeneredTaskfile/Copy/copy.module.css

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
position: sticky;
33
top: 0;
44
float: right;
5-
background-color: #202020;
6-
color: #505050;
7-
border: 0.2rem solid #505050;
8-
padding: 0.5rem 0;
5+
background-color: #10001fc2;
6+
color: rgb(255 255 255 / 0.5);
7+
border: 0.1rem solid rgb(255 255 255 / 0.5);
8+
padding: 1rem;
99
border-radius: 0.2rem;
1010
cursor: pointer;
11-
width: 5rem;
12-
height: 5rem;
11+
width: 5.5rem;
1312
font-size: 1rem;
14-
font-weight: 700;
1513
transition:
16-
color 500ms,
17-
border 500ms;
14+
color 300ms ease-in-out,
15+
border 300ms ease-in-out;
1816
}
1917

2018
.button:hover {
2119
color: #fff;
2220
border-color: #fff;
2321
}
2422

25-
.copied {
26-
color: #2ac93f !important;
27-
border-color: #2ac93f !important;
23+
.button.copied,
24+
.button:hover.copied {
25+
color: #2ac93f;
26+
border-color: #2ac93f;
2827
}

src/components/Generator/generator.module.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
}
1010

1111
.settingsWindow {
12+
background-color: #fff;
1213
width: 25rem;
1314
flex-shrink: 0;
1415
max-width: 100%;
1516
}
1617

1718
.outputWindow {
1819
flex-grow: 1;
20+
background-color: #10001fc2;
21+
color: #fff;
1922
}

0 commit comments

Comments
 (0)