button.tsx 568 B

12345678910111213141516171819202122232425
  1. import * as React from "react";
  2. import styles from "./button.module.css";
  3. export function IconButton(props: {
  4. onClick?: () => void;
  5. icon: JSX.Element;
  6. text?: string;
  7. bordered?: boolean;
  8. className?: string;
  9. }) {
  10. return (
  11. <div
  12. className={
  13. styles["icon-button"] +
  14. ` ${props.bordered && styles.border} ${props.className ?? ""}`
  15. }
  16. >
  17. <div className={styles["icon-button-icon"]}>{props.icon}</div>
  18. {props.text && (
  19. <div className={styles["icon-button-text"]}>{props.text}</div>
  20. )}
  21. </div>
  22. );
  23. }