| 2 | import styles from "./Button.module.css"; |
| 3 | |
| 4 | export const Button = ({ red, bold, icon, rightIcon, children, ...props }) => { |
| 5 | const c = [styles.container]; |
| 6 | |
| 7 | if (bold) { |
| 8 | c.push(styles.bold); |
| 9 | } |
| 10 | if (icon) { |
| 11 | c.push(styles.hasLeftIcon); |
| 12 | } |
| 13 | if (rightIcon) { |
| 14 | c.push(styles.hasRightIcon); |
| 15 | } |
| 16 | if (red) { |
| 17 | c.push(styles.red); |
| 18 | } |
| 19 | |
| 20 | return ( |
| 21 | <button className={styles.button} {...props}> |
| 22 | <div className={c.join(" ")}> |
| 23 | {icon && <div className={styles.leftIcon}>{icon}</div>} |
| 24 | {children} |
| 25 | {rightIcon && ( |
| 26 | <div className={styles.rightIcon}>{rightIcon}</div> |
| 27 | )} |
| 28 | </div> |
| 29 | </button> |
| 30 | ); |
| 31 | }; |