Skip to content

Commit c7d52a1

Browse files
committed
feat: Add CircleButton component with customizable sizes and variants
1 parent fe41293 commit c7d52a1

3 files changed

Lines changed: 98 additions & 11 deletions

File tree

src/components/Elements/Button/Button.css

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,71 @@
1111
align-items: center;
1212
justify-content: center;
1313
gap: 0.5rem;
14+
1415
&:hover {
1516
background-color: var(--button-hover-background-color);
1617
color: var(--button-hover-text-color);
1718
}
18-
}
1919

20-
button.small {
21-
padding: 0.3rem 0.75rem;
22-
font-size: 0.875rem;
23-
}
24-
button.medium {
25-
padding: 0.75rem 1.2rem;
26-
font-size: 1.1rem;
20+
&.small {
21+
padding: 0.3rem 0.75rem;
22+
font-size: 0.875rem;
23+
}
24+
25+
&.medium {
26+
padding: 0.75rem 1rem;
27+
font-size: 1.1rem;
28+
height: 40px;
29+
}
30+
31+
&.large {
32+
padding: 1rem 2rem;
33+
font-size: 1.25rem;
34+
}
2735
}
28-
button.large {
29-
padding: 1rem 2rem;
30-
font-size: 1.25rem;
36+
37+
.round-icon-button {
38+
border-radius: 50px;
39+
cursor: pointer;
40+
display: inline-flex;
41+
align-items: center;
42+
justify-content: center;
43+
gap: 0.5rem;
44+
border: none;
45+
padding: 0;
46+
padding: 0;
47+
48+
&.small {
49+
min-width: 30px;
50+
height: 30px;
51+
}
52+
53+
&.medium {
54+
min-width: 40px;
55+
height: 40px;
56+
}
57+
58+
&.large {
59+
min-width: 50px;
60+
height: 50px;
61+
}
62+
63+
&.primary {
64+
background-color: var(--button-background-color);
65+
color: var(--button-text-color);
66+
67+
&:hover {
68+
background-color: var(--button-hover-background-color);
69+
color: var(--button-hover-text-color);
70+
}
71+
}
72+
73+
&.dark-focus {
74+
background-color: var(--dark-mode-background-color);
75+
color: var(--dark-mode-text-color);
76+
77+
&:hover {
78+
opacity: 0.9;
79+
}
80+
}
3181
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import clsx from 'clsx'
2+
3+
const sizes = {
4+
small: 'small',
5+
medium: 'medium',
6+
large: 'large',
7+
}
8+
9+
const variants = {
10+
primary: 'primary',
11+
darkfocus: 'dark-focus',
12+
}
13+
14+
type CircleButtonProps = {
15+
className?: string
16+
onClick: () => void
17+
size?: keyof typeof sizes
18+
variant?: keyof typeof variants
19+
children: React.ReactNode
20+
}
21+
22+
export const CircleButton = ({
23+
size = 'medium',
24+
variant = 'primary',
25+
onClick,
26+
className,
27+
children,
28+
}: CircleButtonProps) => {
29+
return (
30+
<button
31+
className={clsx('round-icon-button', sizes[size], variants[variant], className)}
32+
onClick={onClick}>
33+
{children}
34+
</button>
35+
)
36+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './Button'
2+
export * from './CircleButton'

0 commit comments

Comments
 (0)