AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

about.tsx 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { cn } from '@/lib/utils';
  2. import type { AboutSection } from '../types';
  3. import { Container } from '../ui';
  4. export function About({ section }: { section: AboutSection }) {
  5. const { heading, body, stats } = section.content;
  6. const showStats = section.variant === 'with-stats' && stats.length > 0;
  7. // statement: the story as one large statement, with the heading as a small label above it.
  8. if (section.variant === 'statement') {
  9. return (
  10. <section
  11. id={section.id}
  12. className="sf-section scroll-mt-20 py-16 md:py-28"
  13. data-layout="statement"
  14. >
  15. <Container className="max-w-5xl">
  16. <h2 className="text-xs font-semibold tracking-[0.18em] text-(--sf-primary) uppercase">
  17. {heading}
  18. </h2>
  19. <p
  20. className={cn(
  21. 'sf-heading mt-6 leading-snug font-medium text-balance whitespace-pre-line',
  22. // A long story reads better a step smaller.
  23. body.length > 220
  24. ? 'text-xl sm:text-2xl md:text-3xl'
  25. : 'text-2xl sm:text-4xl md:text-5xl md:leading-[1.15]',
  26. )}
  27. >
  28. {body}
  29. </p>
  30. {stats.length > 0 && (
  31. <dl className="mt-12 flex flex-wrap gap-x-14 gap-y-6 border-t border-(--sf-border) pt-8">
  32. {stats.map((stat) => (
  33. <div
  34. key={stat.label}
  35. className="flex flex-col-reverse gap-1"
  36. >
  37. <dt className="text-sm text-(--sf-muted)">
  38. {stat.label}
  39. </dt>
  40. <dd className="sf-heading text-3xl font-semibold text-(--sf-primary)">
  41. {stat.value}
  42. </dd>
  43. </div>
  44. ))}
  45. </dl>
  46. )}
  47. </Container>
  48. </section>
  49. );
  50. }
  51. return (
  52. <section
  53. id={section.id}
  54. className="sf-section scroll-mt-20 py-16 md:py-24"
  55. >
  56. <Container
  57. className={showStats ? 'grid gap-12 md:grid-cols-2' : ''}
  58. >
  59. <div
  60. className={showStats ? '' : 'mx-auto max-w-2xl text-center'}
  61. >
  62. <h2 className="sf-heading text-3xl leading-tight font-semibold text-balance sm:text-4xl">
  63. {heading}
  64. </h2>
  65. <p className="mt-5 text-lg leading-relaxed whitespace-pre-line text-(--sf-muted)">
  66. {body}
  67. </p>
  68. </div>
  69. {showStats && (
  70. <dl className="sf-card grid content-center gap-px overflow-hidden rounded-(--sf-radius-card) border border-(--sf-border) bg-(--sf-border) sm:grid-cols-3 md:grid-cols-1">
  71. {stats.map((stat) => (
  72. <div
  73. key={stat.label}
  74. className="flex flex-col-reverse gap-1 bg-(--sf-bg) p-6"
  75. >
  76. <dt className="text-sm text-(--sf-muted)">
  77. {stat.label}
  78. </dt>
  79. <dd className="sf-heading text-3xl font-semibold text-(--sf-primary)">
  80. {stat.value}
  81. </dd>
  82. </div>
  83. ))}
  84. </dl>
  85. )}
  86. </Container>
  87. </section>
  88. );
  89. }