Spaces:
Running
Running
File size: 1,076 Bytes
77fd7a1 3206d59 77fd7a1 e4526cf 77fd7a1 b3ee86d 77fd7a1 3206d59 5c877fe 3637bbd 77fd7a1 3637bbd 77fd7a1 b3ee86d 77fd7a1 3206d59 d9dbd57 77fd7a1 3206d59 d9dbd57 77fd7a1 3637bbd 77fd7a1 5c877fe 3637bbd 5c877fe 77fd7a1 | 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import styles from "./Button.module.css";
import Text from "../../Text/Text";
import React from "react";
interface ButtonProps {
children: React.ReactNode;
width?: string;
fontSize?: "small" | "medium" | "large";
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
buttonRef?: React.Ref<HTMLButtonElement>;
height?: string;
borderRadius?: "default" | "round";
className?: string;
}
function Button(props: Readonly<ButtonProps>) {
const {
children,
width = "100px",
fontSize = "large",
buttonRef,
onClick,
height,
borderRadius = "default",
} = props;
const inlineStyles: React.CSSProperties = {
width: width,
height: height,
borderRadius: borderRadius === "default" ? "10px" : "2em",
};
return (
<button
className={`${styles.button} ${props.className}`}
style={inlineStyles}
ref={buttonRef}
onClick={onClick}
>
<Text interactable={false} fontWeight={"bold"} fontSize={fontSize}>
{children}
</Text>
</button>
);
}
export default Button;
|