Card.tsx 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { BaseComponentProps } from "@json-render/solid";
  2. interface CardProps {
  3. title?: string;
  4. subtitle?: string;
  5. }
  6. export function Card(renderProps: BaseComponentProps<CardProps>) {
  7. return (
  8. <div
  9. style={{
  10. background: "#ffffff",
  11. "border-radius": "12px",
  12. border: "1px solid #e5e7eb",
  13. padding: "20px",
  14. "box-shadow": "0 1px 3px rgba(0,0,0,0.06)",
  15. }}
  16. >
  17. {renderProps.props.title && (
  18. <h2
  19. style={{
  20. "font-size": "18px",
  21. "font-weight": "600",
  22. "margin-bottom": renderProps.props.subtitle ? "4px" : "16px",
  23. }}
  24. >
  25. {renderProps.props.title}
  26. </h2>
  27. )}
  28. {renderProps.props.subtitle && (
  29. <p
  30. style={{
  31. "font-size": "14px",
  32. color: "#6b7280",
  33. "margin-bottom": "16px",
  34. }}
  35. >
  36. {renderProps.props.subtitle}
  37. </p>
  38. )}
  39. {renderProps.children}
  40. </div>
  41. );
  42. }