-
-
Notifications
You must be signed in to change notification settings - Fork 277
Expand file tree
/
Copy pathButton.tsx
More file actions
31 lines (25 loc) · 885 Bytes
/
Button.tsx
File metadata and controls
31 lines (25 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// biome-ignore lint/style/useImportType: React is not a type
import React from "react";
import styles from "../styles/modules/button.module.scss";
// Round is the default style
// Circle is used by the install/remove button
type ButtonType = "round" | "circle";
const Button = (props: {
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
classes?: string[];
label?: string | null;
type?: ButtonType;
children: React.ReactNode;
disabled?: boolean;
}) => {
const buttonType = props.type || "round";
const classList = [styles.button];
if (buttonType === "circle") classList.push(styles.circle);
if (props.classes) classList.push(...props.classes);
return (
<button className={classList.join(" ")} onClick={props.onClick} aria-label={props.label || ""} disabled={props.disabled}>
{props.children}
</button>
);
};
export default Button;