ui-lib.tsx 991 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import styles from "./ui-lib.module.css";
  2. export function Popover(props: {
  3. children: JSX.Element;
  4. content: JSX.Element;
  5. open?: boolean;
  6. onClose?: () => void;
  7. }) {
  8. return (
  9. <div className={styles.popover}>
  10. {props.children}
  11. {props.open && (
  12. <div className={styles["popover-content"]}>
  13. <div className={styles["popover-mask"]} onClick={props.onClose}></div>
  14. {props.content}
  15. </div>
  16. )}
  17. </div>
  18. );
  19. }
  20. export function Card(props: { children: JSX.Element[]; className?: string }) {
  21. return (
  22. <div className={styles.card + " " + props.className}>{props.children}</div>
  23. );
  24. }
  25. export function ListItem(props: { children: JSX.Element[] }) {
  26. if (props.children.length > 2) {
  27. throw Error("Only Support Two Children");
  28. }
  29. return <div className={styles["list-item"]}>{props.children}</div>;
  30. }
  31. export function List(props: { children: JSX.Element[] }) {
  32. return <div className={styles.list}>{props.children}</div>;
  33. }