Cards.tsx 926 B

123456789101112131415161718192021222324252627282930313233343536
  1. import Link from '@/components/Link';
  2. import Icon from '@/components/Icon';
  3. export function Cards({ children, ...props }) {
  4. return <div className="cards">{children}</div>;
  5. }
  6. export function Card({ children, title, icon, href, ...props }) {
  7. let Component: typeof Link | string = Link;
  8. if (!href) {
  9. Component = 'div';
  10. }
  11. return (
  12. <Component className="card" href={href}>
  13. <div className="card-body">
  14. <div className="row items-center">
  15. <div className="col">
  16. {icon && <Icon name={icon} className="card-icon" />}
  17. {title && <div className="card-title">{title}</div>}
  18. {children}
  19. </div>
  20. {href && (
  21. <div className="col-auto">
  22. <div className="card-chevron">
  23. <Icon name="chevron-right" />
  24. </div>
  25. </div>
  26. )}
  27. </div>
  28. </div>
  29. </Component>
  30. );
  31. }