Skip to content

Commit aeaba16

Browse files
committed
tweak styles
1 parent b2e7b30 commit aeaba16

File tree

5 files changed

+47
-13
lines changed

5 files changed

+47
-13
lines changed

frontend/lib/icon/generated.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ export const IconCheckmark = (props: React.SVGAttributes<SVGElement>) => (
8989
</svg>
9090
);
9191

92+
export const IconCheckmarkSmall = (props: React.SVGAttributes<SVGElement>) => (
93+
<svg {...props} xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 14 14">
94+
<path d="M5.2,10.9h0c-.3,0-.5-.1-.7-.3l-2.9-2.9c-.4-.4-.4-1,0-1.4.4-.4,1-.4,1.4,0l2.2,2.2,5.7-5.7c.4-.4,1-.4,1.4,0s.4,1,0,1.4l-6.4,6.4c-.2.2-.4.3-.7.3Z" />
95+
</svg>
96+
);
97+
9298
export const IconChevronRight = (props: React.SVGAttributes<SVGElement>) => (
9399
<svg {...props} viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
94100
<path
Lines changed: 3 additions & 0 deletions
Loading

frontend/lib/ui/Checkbox/Checkbox.module.css

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,31 @@
1616
> div {
1717
display: inline-block;
1818
margin-right: 8px;
19+
flex: 0 0 20px;
1920
width: 20px;
2021
height: 20px;
2122
border-radius: 6px;
2223
padding: 0;
23-
border: 1px solid var(--base-dark-blue);
24-
background-color: var(--bg-highlight);
24+
border: 1px solid var(--border-color-default);
25+
background-color: #fff;
2526
display: flex;
2627
align-items: center;
2728
justify-content: center;
29+
30+
&:focus {
31+
outline: none;
32+
box-shadow: 0 0 1px 1px rgba(66, 210, 243, 0.4);
33+
border: 1px solid var(--blue-dark-400);
34+
}
35+
36+
&:global(.checked) {
37+
background-color: var(--bg-highlight);
38+
border-color: var(--base-dark-blue);
39+
}
40+
2841
svg {
2942
width: 14px;
43+
fill: var(--base-dark-blue);
3044
}
3145
}
3246

frontend/lib/ui/Checkbox/Checkbox.stories.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@ type Props = {
77
};
88

99
export const DefaultCheckbox: Story<Props> = ({ label }) => (
10-
<Checkbox id="default-checkbox" defaultChecked={false}>
11-
{label}
12-
</Checkbox>
13-
);
10+
<div>
11+
<Checkbox id="default-checkbox" defaultChecked={false}>
12+
{label}
13+
</Checkbox>
14+
15+
<Checkbox id="default-checkbox-error" defaultChecked={false} hasError>
16+
{label}
17+
</Checkbox>
1418

15-
export const ErrorCheckbox: Story<Props> = ({ label }) => (
16-
<Checkbox id="default-checkbox" hasError defaultChecked={false}>
17-
{label}
18-
</Checkbox>
19+
<div style={{ width: 200 }}>
20+
<Checkbox id="default-checkbox-cramped" defaultChecked={false}>
21+
{label}
22+
</Checkbox>
23+
</div>
24+
</div>
1925
);
2026

2127
export default {

frontend/lib/ui/Checkbox/Checkbox.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
22

3-
import { IconCheckmark } from "@kiesraad/icon";
3+
import { IconCheckmarkSmall } from "@kiesraad/icon";
44
import { cn } from "@kiesraad/util";
55

66
import cls from "./Checkbox.module.css";
@@ -29,8 +29,13 @@ export function Checkbox({ id, children, defaultChecked, hasError }: CheckboxPro
2929
aria-label="input"
3030
id={`checkbox-container-${id}`}
3131
>
32-
<div aria-hidden={true} onClick={toggleCheckbox} id={`checkbox-button-${id}`}>
33-
{checked ? <IconCheckmark aria-label="Aangevinkt" /> : null}
32+
<div
33+
className={checked ? "checked" : "unchecked"}
34+
aria-hidden={true}
35+
onClick={toggleCheckbox}
36+
id={`checkbox-button-${id}`}
37+
>
38+
{checked ? <IconCheckmarkSmall aria-label="Aangevinkt" /> : null}
3439
</div>
3540
<input type="checkbox" id={id} name={id} checked={checked} onChange={toggleCheckbox} />
3641
<label htmlFor={id}>{children}</label>

0 commit comments

Comments
 (0)