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.

home.tsx 73KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777
  1. import { Head, Link, usePage } from '@inertiajs/react';
  2. import {
  3. ArrowRight,
  4. Check,
  5. ChevronDown,
  6. Globe,
  7. Layers,
  8. MessageCircle,
  9. Package,
  10. Palette,
  11. ShieldCheck,
  12. Sparkles,
  13. Tag,
  14. Truck,
  15. Video,
  16. } from 'lucide-react';
  17. import type { CSSProperties, FormEvent, ReactNode, RefObject } from 'react';
  18. import { useEffect, useRef, useState } from 'react';
  19. import {
  20. lessMotion,
  21. onScroll,
  22. revealDelay,
  23. usePageReveal,
  24. useSeen,
  25. useTyping,
  26. } from '@/components/home/motion';
  27. import { fontsUrl, heading, Logo, palette } from '@/components/home/brand';
  28. import { dashboard, login, privacy, register, terms } from '@/routes';
  29. type Plan = {
  30. key: string;
  31. name: string;
  32. price: number;
  33. stores: number;
  34. regenerations: number;
  35. edits: number;
  36. /** "total" for the trial, "month" for paid plans. */
  37. period: string;
  38. };
  39. /** Where the page's "Start free" buttons go: the dashboard for someone signed in, otherwise sign-up. */
  40. function useStartUrl(): string {
  41. const { auth } = usePage().props as { auth?: { user?: unknown } };
  42. return auth?.user ? dashboard().url : register().url;
  43. }
  44. export default function Home({
  45. plans,
  46. trialDays,
  47. storeDomain,
  48. }: {
  49. plans: Plan[];
  50. trialDays: number;
  51. storeDomain: string;
  52. }) {
  53. const page = useRef<HTMLDivElement>(null);
  54. usePageReveal(page);
  55. return (
  56. <>
  57. <Head title="Online stores designed by AI">
  58. <link rel="stylesheet" href={fontsUrl} />
  59. <meta
  60. name="description"
  61. content="Describe your brand and AI Commerce designs a store that is ready to sell, with payments, shipping across Malaysia, WhatsApp and discounts built in."
  62. />
  63. </Head>
  64. <div
  65. ref={page}
  66. style={palette}
  67. className="min-h-screen bg-(--h-paper) font-['Instrument_Sans',ui-sans-serif,system-ui,sans-serif] text-(--h-ink) antialiased"
  68. >
  69. <Nav />
  70. <main>
  71. <Hero storeDomain={storeDomain} trialDays={trialDays} />
  72. <ShopTypes />
  73. <TwoSides storeDomain={storeDomain} />
  74. <Steps />
  75. <ChatSection />
  76. <Styles />
  77. <Features />
  78. <Pricing plans={plans} trialDays={trialDays} />
  79. <Faq trialDays={trialDays} />
  80. <FinalCall trialDays={trialDays} />
  81. </main>
  82. <Footer />
  83. </div>
  84. </>
  85. );
  86. }
  87. function Section({
  88. id,
  89. className,
  90. children,
  91. }: {
  92. id?: string;
  93. className?: string;
  94. children: ReactNode;
  95. }) {
  96. return (
  97. <section
  98. id={id}
  99. className={`scroll-mt-20 px-5 sm:px-8 ${className ?? ''}`}
  100. >
  101. <div className="mx-auto w-full max-w-6xl">{children}</div>
  102. </section>
  103. );
  104. }
  105. function Kicker({ children }: { children: ReactNode }) {
  106. return (
  107. <p className="text-sm font-semibold tracking-wide text-(--h-pandan) uppercase">
  108. {children}
  109. </p>
  110. );
  111. }
  112. function Title({
  113. children,
  114. className,
  115. }: {
  116. children: ReactNode;
  117. className?: string;
  118. }) {
  119. return (
  120. <h2
  121. className={`${heading} mt-3 text-3xl leading-[1.1] font-extrabold tracking-tight text-balance sm:text-4xl md:text-5xl ${className ?? ''}`}
  122. >
  123. {children}
  124. </h2>
  125. );
  126. }
  127. function Nav() {
  128. const { auth } = usePage().props as { auth?: { user?: unknown } };
  129. const start = useStartUrl();
  130. return (
  131. <header className="sticky top-0 z-30 border-b border-(--h-line)/70 bg-(--h-paper)/85 px-5 backdrop-blur sm:px-8">
  132. <div className="mx-auto flex h-16 w-full max-w-6xl items-center justify-between gap-3">
  133. <a
  134. href="#top"
  135. aria-label="AI Commerce home"
  136. className="shrink-0"
  137. >
  138. <Logo />
  139. </a>
  140. <nav
  141. aria-label="Main"
  142. className="hidden items-center gap-7 text-sm font-medium text-(--h-muted) md:flex"
  143. >
  144. <a href="#how" className="hover:text-(--h-ink)">
  145. How it works
  146. </a>
  147. <a href="#features" className="hover:text-(--h-ink)">
  148. Features
  149. </a>
  150. <a href="#pricing" className="hover:text-(--h-ink)">
  151. Pricing
  152. </a>
  153. <a href="#faq" className="hover:text-(--h-ink)">
  154. Questions
  155. </a>
  156. </nav>
  157. <div className="flex items-center gap-2">
  158. {auth?.user ? (
  159. <Link
  160. href={dashboard()}
  161. className="rounded-full bg-(--h-ink) px-4 py-2 text-sm font-semibold whitespace-nowrap text-white hover:bg-(--h-pandan-deep)"
  162. >
  163. Dashboard
  164. </Link>
  165. ) : (
  166. <>
  167. <Link
  168. href={login()}
  169. className="rounded-full px-3 py-2 text-sm font-semibold whitespace-nowrap hover:bg-(--h-pandan-soft)"
  170. >
  171. Log in
  172. </Link>
  173. <Link
  174. href={start}
  175. className="rounded-full bg-(--h-ink) px-4 py-2 text-sm font-semibold whitespace-nowrap text-white hover:bg-(--h-pandan-deep)"
  176. >
  177. Start free
  178. </Link>
  179. </>
  180. )}
  181. </div>
  182. </div>
  183. </header>
  184. );
  185. }
  186. /** "Sambal Mak Teh" becomes "sambal-mak-teh", the way store addresses are made. */
  187. function slugify(name: string): string {
  188. return name
  189. .toLowerCase()
  190. .normalize('NFKD')
  191. .replace(/[^a-z0-9\s-]/g, '')
  192. .trim()
  193. .replace(/[\s-]+/g, '-')
  194. .slice(0, 40);
  195. }
  196. function Hero({
  197. storeDomain,
  198. trialDays,
  199. }: {
  200. storeDomain: string;
  201. trialDays: number;
  202. }) {
  203. const { auth } = usePage().props as { auth?: { user?: unknown } };
  204. const [name, setName] = useState('');
  205. const slug = slugify(name) || 'your-store';
  206. const stage = useRef<HTMLElement>(null);
  207. const [animate] = useState(() => !lessMotion());
  208. const typing = useTyping(bubbleText, animate, 600);
  209. const { progress, pinned, motion } = useAssembly(stage, typing.done);
  210. function start(event: FormEvent) {
  211. event.preventDefault();
  212. // Kept in this browser so the "Create a store" form can fill in the name after sign-up.
  213. try {
  214. if (name.trim() !== '') {
  215. window.localStorage.setItem('pending-store-name', name.trim());
  216. }
  217. } catch {
  218. // Private windows may refuse storage; the merchant just types the name again.
  219. }
  220. window.location.href = auth?.user
  221. ? `/stores/create?name=${encodeURIComponent(name.trim())}`
  222. : register().url;
  223. }
  224. return (
  225. <section
  226. id="top"
  227. ref={stage}
  228. // On wide screens the hero stays pinned while the store comes together, so it is taller.
  229. className={pinned ? 'relative lg:h-[210vh]' : 'relative'}
  230. >
  231. <div
  232. className={
  233. pinned
  234. ? 'lg:sticky lg:top-16 lg:flex lg:h-[calc(100vh-4rem)] lg:items-center'
  235. : ''
  236. }
  237. >
  238. <div className="relative w-full overflow-hidden px-5 pt-14 pb-20 sm:px-8 md:pt-20 md:pb-28">
  239. {/* Soft shapes in the background, in the page's colours. */}
  240. <div
  241. aria-hidden="true"
  242. className="pointer-events-none absolute -top-40 -right-40 size-[520px] rounded-full bg-(--h-kunyit-soft) opacity-70 blur-3xl"
  243. />
  244. <div
  245. aria-hidden="true"
  246. className="pointer-events-none absolute top-40 -left-48 size-[420px] rounded-full bg-(--h-pandan-soft) blur-3xl"
  247. />
  248. <div className="relative mx-auto grid w-full max-w-6xl items-center gap-14 lg:grid-cols-[1.05fr_1fr]">
  249. <div className="relative z-30">
  250. <p className="inline-flex items-center gap-2 rounded-full border border-(--h-line) bg-(--h-card) px-3 py-1 text-sm font-medium text-(--h-muted)">
  251. <span className="size-2 rounded-full bg-(--h-bunga)" />
  252. Made for Malaysian sellers
  253. </p>
  254. <h1
  255. className={`${heading} mt-6 text-[2.6rem] leading-[1.03] font-extrabold tracking-tight text-balance sm:text-6xl`}
  256. >
  257. Tell us about your brand.{' '}
  258. <span className="text-(--h-pandan)">
  259. Get a store that is ready to sell.
  260. </span>
  261. </h1>
  262. <p className="mt-6 max-w-xl text-lg leading-relaxed text-(--h-muted)">
  263. Write a few lines about what you sell. AI
  264. Commerce designs your whole online store, with
  265. payments, shipping across Malaysia, WhatsApp and
  266. discounts already in place. Then change anything
  267. by chat.
  268. </p>
  269. <form
  270. onSubmit={start}
  271. className="mt-8 max-w-xl rounded-2xl border border-(--h-line) bg-(--h-card) p-2 shadow-[0_10px_30px_-12px_rgba(16,36,28,0.25)]"
  272. >
  273. <label
  274. htmlFor="store-name"
  275. className="block px-3 pt-2 text-xs font-semibold tracking-wide text-(--h-muted) uppercase"
  276. >
  277. Name your store
  278. </label>
  279. <div className="flex flex-col gap-2 sm:flex-row sm:items-center">
  280. <input
  281. id="store-name"
  282. value={name}
  283. onChange={(event) =>
  284. setName(event.target.value)
  285. }
  286. maxLength={60}
  287. placeholder="Sambal Mak Teh"
  288. className="min-w-0 flex-1 bg-transparent px-3 py-2 text-lg font-semibold outline-none placeholder:font-normal placeholder:text-(--h-muted)/60"
  289. />
  290. <button
  291. type="submit"
  292. className="inline-flex items-center justify-center gap-2 rounded-xl bg-(--h-pandan) px-5 py-3 font-semibold text-white transition-colors hover:bg-(--h-pandan-deep) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--h-pandan)"
  293. >
  294. Start free
  295. <ArrowRight
  296. className="size-4"
  297. aria-hidden="true"
  298. />
  299. </button>
  300. </div>
  301. <p
  302. className="px-3 pt-1 pb-2 text-sm text-(--h-muted)"
  303. aria-live="polite"
  304. >
  305. Your store's address:{' '}
  306. <span className="font-semibold text-(--h-ink)">
  307. {slug}.{storeDomain}
  308. </span>
  309. </p>
  310. </form>
  311. <p className="mt-4 text-sm text-(--h-muted)">
  312. Free for {trialDays} days. No card needed to
  313. start.
  314. </p>
  315. </div>
  316. <HeroVisual
  317. storeDomain={storeDomain}
  318. progress={progress}
  319. pinned={pinned}
  320. motion={motion}
  321. typed={typing.shown}
  322. />
  323. </div>
  324. </div>
  325. </div>
  326. </section>
  327. );
  328. }
  329. type Motion = { progress: number; pinned: boolean; motion: boolean };
  330. /** What the merchant types in the hero picture. */
  331. const bubbleText =
  332. 'Homemade Kelantan sambal and serunding in jars. Warm, family recipes for busy families.';
  333. /**
  334. * How far the hero's store has come together, from 0 (pieces scattered) to 1 (finished store).
  335. *
  336. * - Wide screens: the hero stays pinned while the visitor scrolls, and scrolling puts the store together.
  337. * - Phones and tablets: it plays once by itself, after the merchant's words have been typed out.
  338. * - Visitors who ask their device for less motion see the finished store, with nothing moving.
  339. */
  340. function useAssembly(
  341. stage: RefObject<HTMLElement | null>,
  342. ready: boolean,
  343. ): Motion {
  344. const [state, setState] = useState<Motion>(() => {
  345. const reduce = lessMotion();
  346. const wide =
  347. typeof window !== 'undefined' &&
  348. window.matchMedia('(min-width: 1024px)').matches;
  349. return reduce
  350. ? { progress: 1, pinned: false, motion: false }
  351. : { progress: 0, pinned: wide, motion: true };
  352. });
  353. useEffect(() => {
  354. if (!state.motion) {
  355. return;
  356. }
  357. let frame = 0;
  358. if (state.pinned) {
  359. // Scrolling through the pinned hero puts the store together; it is finished a little before
  360. // the pin ends, so the finished store stays in view for a moment.
  361. const update = () => {
  362. cancelAnimationFrame(frame);
  363. frame = requestAnimationFrame(() => {
  364. const section = stage.current;
  365. if (!section) {
  366. return;
  367. }
  368. const travel = section.offsetHeight - window.innerHeight;
  369. const scrolled = -section.getBoundingClientRect().top;
  370. const progress =
  371. travel > 0 ? clamp(scrolled / (travel * 0.8)) : 1;
  372. setState((current) =>
  373. current.progress === progress
  374. ? current
  375. : { ...current, progress },
  376. );
  377. });
  378. };
  379. update();
  380. window.addEventListener('scroll', update, { passive: true });
  381. window.addEventListener('resize', update);
  382. return () => {
  383. cancelAnimationFrame(frame);
  384. window.removeEventListener('scroll', update);
  385. window.removeEventListener('resize', update);
  386. };
  387. }
  388. // Not pinned: play once, over about a second and a half, after the merchant's words are typed.
  389. if (!ready) {
  390. return;
  391. }
  392. const started = performance.now() + 300;
  393. const play = (now: number) => {
  394. const progress = clamp((now - started) / 1500);
  395. setState((current) => ({ ...current, progress }));
  396. if (progress < 1) {
  397. frame = requestAnimationFrame(play);
  398. }
  399. };
  400. frame = requestAnimationFrame(play);
  401. return () => cancelAnimationFrame(frame);
  402. }, [state.motion, state.pinned, stage, ready]);
  403. return state;
  404. }
  405. function clamp(value: number): number {
  406. return Math.min(1, Math.max(0, value));
  407. }
  408. /** Slow at the start and the end, quick in the middle. */
  409. function ease(t: number): number {
  410. return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
  411. }
  412. /**
  413. * Where one piece is on its way in: it starts moved by (x, y), turned by r degrees and scaled by s,
  414. * and arrives at its place in the store. Each piece starts a little later than the one before.
  415. */
  416. function flyIn(
  417. progress: number,
  418. from: { x: number; y: number; r: number; s?: number },
  419. delay: number,
  420. ): CSSProperties {
  421. const t = ease(clamp((progress - delay) / 0.55));
  422. const left = 1 - t;
  423. return {
  424. transform: `translate(${from.x * left}px, ${from.y * left}px) rotate(${from.r * left}deg) scale(${1 + ((from.s ?? 1) - 1) * left})`,
  425. };
  426. }
  427. /** A merchant's words turning into a finished store, with the parts that come built in. */
  428. function HeroVisual({
  429. storeDomain,
  430. progress,
  431. pinned,
  432. motion,
  433. typed,
  434. }: {
  435. storeDomain: string;
  436. progress: number;
  437. pinned: boolean;
  438. motion: boolean;
  439. /** How many letters of the merchant's words have been typed so far. */
  440. typed: number;
  441. }) {
  442. const chip =
  443. 'flex items-center gap-1.5 rounded-full border border-(--h-line) bg-(--h-card) px-3 py-1.5 text-xs font-semibold whitespace-nowrap text-(--h-ink) shadow-[0_10px_24px_-10px_rgba(16,36,28,0.35)]';
  444. const frameIn = ease(clamp((progress - 0.2) / 0.5));
  445. const chipsIn = clamp((progress - 0.55) / 0.35);
  446. const products = [
  447. {
  448. name: 'Sambal tumis',
  449. price: 'RM 14.90',
  450. colour: '#B4361E',
  451. from: { x: -40, y: 210, r: -12, s: 1.1 },
  452. delay: 0.12,
  453. },
  454. {
  455. name: 'Serunding',
  456. price: 'RM 18.90',
  457. colour: '#8A5A2B',
  458. from: { x: 60, y: 280, r: 9, s: 1.1 },
  459. delay: 0.2,
  460. },
  461. {
  462. name: 'Budu',
  463. price: 'RM 9.90',
  464. colour: '#5B3A1C',
  465. from: { x: 170, y: 190, r: 15, s: 1.1 },
  466. delay: 0.28,
  467. },
  468. ];
  469. // A tag floats in from (x, y) once the store is together, and then bobs gently.
  470. const tag = (
  471. from: { x: number; y: number },
  472. bob: string,
  473. children: ReactNode,
  474. place: string,
  475. ) => (
  476. <span
  477. className={`absolute z-20 ${place}`}
  478. style={{
  479. opacity: chipsIn,
  480. transform: `translate(${from.x * (1 - chipsIn)}px, ${from.y * (1 - chipsIn)}px)`,
  481. }}
  482. >
  483. <span className={`${chip} ${motion ? bob : ''}`}>{children}</span>
  484. </span>
  485. );
  486. return (
  487. <div
  488. className="relative mx-auto w-full max-w-lg pt-12"
  489. aria-hidden="true"
  490. >
  491. {/* What the merchant typed. It comes first, and moves to its corner as the store forms. */}
  492. <div
  493. className="group/bubble relative z-10 ml-auto w-[80%] transition-[translate,scale] duration-300 ease-out hover:z-30 motion-safe:hover:-translate-y-2 motion-safe:hover:scale-[1.03]"
  494. style={flyIn(progress, { x: 30, y: 150, r: -4, s: 1.12 }, 0)}
  495. >
  496. <div
  497. className={`${motion ? 'h-float' : ''} rotate-[1.5deg] rounded-2xl rounded-br-sm bg-(--h-ink) p-4 text-sm text-white shadow-lg transition-[rotate,box-shadow] duration-300 group-hover/bubble:rotate-0 group-hover/bubble:shadow-2xl`}
  498. >
  499. <p className="text-xs font-semibold tracking-wide text-(--h-kunyit) uppercase">
  500. You write
  501. </p>
  502. {/* The full words hold the bubble's size, so it does not grow while they are typed. */}
  503. <p className="relative mt-1.5 leading-relaxed">
  504. <span className="invisible">{bubbleText}</span>
  505. <span className="absolute inset-0">
  506. {bubbleText.slice(0, typed)}
  507. {typed < bubbleText.length && (
  508. <span className="ml-0.5 inline-block h-[1.05em] w-0.5 translate-y-0.5 animate-pulse bg-(--h-kunyit)" />
  509. )}
  510. </span>
  511. </p>
  512. </div>
  513. </div>
  514. {/* The store it becomes: its frame fades in while its pieces fly into place. */}
  515. {/* The store floats gently on its own beat, like the bubble above it. */}
  516. <div
  517. className={`group/store relative -mt-3 transition-[translate,scale] duration-300 ease-out hover:z-20 motion-safe:hover:-translate-y-2 motion-safe:hover:scale-[1.02] ${motion ? 'h-float h-float-late' : ''}`}
  518. >
  519. <div
  520. className="absolute inset-0 rounded-2xl border border-(--h-line) bg-(--h-card) shadow-[0_30px_60px_-25px_rgba(16,36,28,0.45)] transition-shadow duration-300 group-hover/store:shadow-[0_45px_90px_-30px_rgba(16,36,28,0.6)]"
  521. style={{
  522. opacity: frameIn,
  523. transform: `scale(${0.94 + 0.06 * frameIn})`,
  524. }}
  525. />
  526. <div className="relative">
  527. <div
  528. className="flex items-center gap-1.5 border-b border-(--h-line) px-3 py-2"
  529. style={{ opacity: frameIn }}
  530. >
  531. <span className="size-2 rounded-full bg-(--h-line)" />
  532. <span className="size-2 rounded-full bg-(--h-line)" />
  533. <span className="size-2 rounded-full bg-(--h-line)" />
  534. <span className="ml-2 truncate rounded-md bg-(--h-paper) px-2 py-0.5 text-[10px] text-(--h-muted)">
  535. sambal-mak-teh.{storeDomain}
  536. </span>
  537. </div>
  538. <div
  539. className="relative bg-[#2B1A10] px-5 pt-5 pb-6 text-[#FBE9D0] shadow-lg"
  540. style={flyIn(
  541. progress,
  542. { x: 90, y: -50, r: 6, s: 0.92 },
  543. 0.05,
  544. )}
  545. >
  546. <p className="text-[10px] font-semibold tracking-[0.2em] text-[#E9A53B] uppercase">
  547. Kelantan kitchen
  548. </p>
  549. <p className="mt-1.5 font-serif text-2xl leading-tight">
  550. Mak Teh&apos;s cooking, now in a jar
  551. </p>
  552. <span className="mt-3 inline-block rounded-md bg-[#E9A53B] px-3 py-1.5 text-[11px] font-bold text-[#2B1A10]">
  553. Shop the jars
  554. </span>
  555. {/* Beside the button, where the band is always empty. */}
  556. {tag(
  557. { x: 60, y: -10 },
  558. 'h-bob h-bob-slow',
  559. <>
  560. <MessageCircle className="size-3.5 text-[#25D366]" />
  561. WhatsApp button
  562. </>,
  563. 'right-3 bottom-5 sm:-right-8',
  564. )}
  565. </div>
  566. <div className="grid grid-cols-3 gap-2 p-3">
  567. {products.map((product) => (
  568. <div
  569. key={product.name}
  570. className="rounded-lg bg-(--h-paper) p-2 shadow-sm"
  571. style={flyIn(
  572. progress,
  573. product.from,
  574. product.delay,
  575. )}
  576. >
  577. <div className="grid aspect-square place-items-center rounded-md bg-[#F6E7D3]">
  578. <span
  579. className="block h-10 w-8 rounded-t-md rounded-b-lg"
  580. style={{ background: product.colour }}
  581. />
  582. </div>
  583. <p className="mt-1.5 truncate text-[10px] font-semibold">
  584. {product.name}
  585. </p>
  586. <p className="text-[10px] text-(--h-muted)">
  587. {product.price}
  588. </p>
  589. </div>
  590. ))}
  591. </div>
  592. </div>
  593. </div>
  594. {tag(
  595. { x: -40, y: -30 },
  596. 'h-bob',
  597. <>
  598. <Sparkles className="size-3.5 text-(--h-kunyit)" />
  599. Designed in minutes
  600. </>,
  601. 'top-0 left-0',
  602. )}
  603. {tag(
  604. { x: -60, y: 20 },
  605. 'h-bob h-bob-slow',
  606. <>
  607. <ShieldCheck className="size-3.5 text-(--h-pandan)" />
  608. Stripe checkout
  609. </>,
  610. 'bottom-24 -left-3 sm:-left-10',
  611. )}
  612. {tag(
  613. { x: 20, y: 50 },
  614. 'h-bob',
  615. <>
  616. <Truck className="size-3.5 text-(--h-bunga)" />
  617. Shipping to Sabah and Sarawak
  618. </>,
  619. '-bottom-5 right-4',
  620. )}
  621. {pinned && (
  622. <p
  623. className="absolute -bottom-14 left-0 w-full text-center text-sm font-medium text-(--h-muted)"
  624. style={{ opacity: clamp(1 - progress * 2.5) }}
  625. >
  626. Scroll to watch your store come together ↓
  627. </p>
  628. )}
  629. </div>
  630. );
  631. }
  632. /** The kinds of things Malaysian sellers sell, drifting slowly sideways. Hovering stops it. */
  633. function ShopTypes() {
  634. const types = [
  635. 'Sambal',
  636. 'Batik',
  637. 'Skincare',
  638. 'Kek lapis',
  639. 'Tudung',
  640. 'Kopi',
  641. 'Kerepek',
  642. 'Baju kurung',
  643. 'Lilin wangi',
  644. 'Madu',
  645. 'Kuih raya',
  646. 'Songket',
  647. 'Rempah',
  648. 'Kasut',
  649. 'Barang kemas',
  650. 'Kraf tangan',
  651. ];
  652. // The list is drawn twice, so when the first copy has slid out the second has taken its place.
  653. const row = (copy: boolean) => (
  654. <ul
  655. aria-hidden={copy || undefined}
  656. className="flex shrink-0 items-center gap-8 pr-8"
  657. >
  658. {types.map((type) => (
  659. <li
  660. key={type}
  661. className="flex items-center gap-8 whitespace-nowrap"
  662. >
  663. <span>{type}</span>
  664. <span
  665. className="size-1.5 rounded-full bg-(--h-kunyit)"
  666. aria-hidden="true"
  667. />
  668. </li>
  669. ))}
  670. </ul>
  671. );
  672. return (
  673. <section
  674. aria-label="Made for every kind of seller"
  675. className="flex items-center gap-6 overflow-hidden bg-(--h-pandan-deep) py-5 text-white"
  676. >
  677. <p className="hidden shrink-0 pl-8 text-sm font-semibold text-(--h-kunyit) md:block">
  678. Made for sellers of
  679. </p>
  680. <div className="min-w-0 flex-1 [mask-image:linear-gradient(to_right,transparent,black_6%,black_94%,transparent)]">
  681. <div
  682. className={`h-marquee flex w-max ${heading} text-lg font-bold sm:text-xl`}
  683. >
  684. {row(false)}
  685. {row(true)}
  686. </div>
  687. </div>
  688. </section>
  689. );
  690. }
  691. function TwoSides({ storeDomain }: { storeDomain: string }) {
  692. const sides = [
  693. {
  694. tag: 'Your store',
  695. title: 'The page your customers see',
  696. address: `your-store.${storeDomain}`,
  697. points: [
  698. 'Your products, photos, prices and choices such as sizes',
  699. 'Cart and secure checkout, with shipping worked out for them',
  700. 'Opens on any phone. No sign-in for shoppers.',
  701. ],
  702. dark: false,
  703. },
  704. {
  705. tag: 'Your dashboard',
  706. title: 'Where you run the business',
  707. address: 'Products, Orders, Discounts, Design',
  708. points: [
  709. 'Add products, bundles, collections and discount codes',
  710. 'See orders, mark them shipped and add tracking numbers',
  711. 'Change the design with buttons, or simply ask the AI',
  712. ],
  713. dark: true,
  714. },
  715. ];
  716. return (
  717. <Section className="py-24">
  718. <div data-reveal className="max-w-2xl">
  719. <Kicker>One store, two sides</Kicker>
  720. <Title>
  721. A store for your customers. A control room for you.
  722. </Title>
  723. </div>
  724. <div className="mt-10 grid gap-5 md:grid-cols-2">
  725. {sides.map((side, index) => (
  726. <div
  727. key={side.tag}
  728. data-reveal
  729. style={revealDelay(index + 1)}
  730. className={`rounded-3xl p-7 sm:p-9 ${
  731. side.dark
  732. ? 'bg-(--h-pandan-deep) text-white'
  733. : 'border border-(--h-line) bg-(--h-card)'
  734. }`}
  735. >
  736. <p
  737. className={`text-sm font-semibold ${side.dark ? 'text-(--h-kunyit)' : 'text-(--h-pandan)'}`}
  738. >
  739. {side.tag}
  740. </p>
  741. <h3
  742. className={`${heading} mt-2 text-2xl font-extrabold`}
  743. >
  744. {side.title}
  745. </h3>
  746. <p
  747. className={`mt-3 inline-block rounded-lg px-3 py-1 font-mono text-sm ${side.dark ? 'bg-white/10' : 'bg-(--h-paper)'}`}
  748. >
  749. {side.address}
  750. </p>
  751. <ul className="mt-6 space-y-3">
  752. {side.points.map((point) => (
  753. <li key={point} className="flex gap-3">
  754. <Check
  755. className={`mt-0.5 size-5 shrink-0 ${side.dark ? 'text-(--h-kunyit)' : 'text-(--h-pandan)'}`}
  756. aria-hidden="true"
  757. />
  758. <span
  759. className={
  760. side.dark
  761. ? 'text-white/85'
  762. : 'text-(--h-muted)'
  763. }
  764. >
  765. {point}
  766. </span>
  767. </li>
  768. ))}
  769. </ul>
  770. </div>
  771. ))}
  772. </div>
  773. </Section>
  774. );
  775. }
  776. function Steps() {
  777. const start = useStartUrl();
  778. const list = useRef<HTMLOListElement>(null);
  779. const [line, setLine] = useState<StepLine | null>(null);
  780. const [fill, setFill] = useState(() => (lessMotion() ? 1 : 0));
  781. const steps = [
  782. {
  783. title: 'Describe your brand',
  784. text: 'Pick a category and write a few lines in your own words: what you sell, who it is for, the feeling you want.',
  785. },
  786. {
  787. title: 'Get your designed store',
  788. text: 'The AI chooses colours, fonts, a style and the sections that suit your brand, and writes the words in English or Bahasa Malaysia.',
  789. },
  790. {
  791. title: 'Add products and go live',
  792. text: 'Add your photos, prices and stock, set your shipping fees, then press Publish. Your store gets its own address.',
  793. },
  794. ];
  795. useEffect(() => {
  796. const ol = list.current;
  797. if (!ol) {
  798. return;
  799. }
  800. const still = lessMotion();
  801. return onScroll(() => {
  802. // The middle of each number, from the cards' layout positions (their fade-up does not move these).
  803. const centres = Array.from(ol.querySelectorAll('li')).map(
  804. (item) => ({ x: item.offsetLeft + 50, y: item.offsetTop + 50 }),
  805. );
  806. const first = centres[0];
  807. const last = centres[centres.length - 1];
  808. if (!first || !last || centres.length < 2) {
  809. return;
  810. }
  811. const total = Math.hypot(last.x - first.x, last.y - first.y) || 1;
  812. const stops = centres.map(
  813. (centre) =>
  814. Math.hypot(centre.x - first.x, centre.y - first.y) / total,
  815. );
  816. const vertical = last.y - first.y > last.x - first.x;
  817. setLine((current) =>
  818. current &&
  819. current.x1 === first.x &&
  820. current.y1 === first.y &&
  821. current.x2 === last.x &&
  822. current.y2 === last.y
  823. ? current
  824. : {
  825. x1: first.x,
  826. y1: first.y,
  827. x2: last.x,
  828. y2: last.y,
  829. stops,
  830. vertical,
  831. },
  832. );
  833. if (still) {
  834. return;
  835. }
  836. const top = ol.getBoundingClientRect().top;
  837. // Side by side: the line grows while the steps rise from low on the screen to the middle.
  838. // One under another (phones): the tip of the line follows a point 60% down the screen.
  839. setFill(
  840. vertical
  841. ? clamp(
  842. (window.innerHeight * 0.6 - top - first.y) /
  843. (last.y - first.y),
  844. )
  845. : clamp(
  846. (window.innerHeight * 0.85 - top - first.y) /
  847. (window.innerHeight * 0.4),
  848. ),
  849. );
  850. });
  851. }, []);
  852. return (
  853. <Section id="how" className="bg-(--h-card) py-24">
  854. <div
  855. data-reveal
  856. className="flex flex-wrap items-end justify-between gap-6"
  857. >
  858. <div className="max-w-2xl">
  859. <Kicker>How it works</Kicker>
  860. <Title>From a few lines to a live store</Title>
  861. </div>
  862. <Link
  863. href={start}
  864. className="inline-flex items-center gap-2 rounded-full border border-(--h-ink) px-5 py-2.5 font-semibold hover:bg-(--h-ink) hover:text-white"
  865. >
  866. Try it free
  867. <ArrowRight className="size-4" aria-hidden="true" />
  868. </Link>
  869. </div>
  870. <ol
  871. ref={list}
  872. data-reveal
  873. style={revealDelay(1)}
  874. className="relative mt-12 grid gap-5 md:grid-cols-3"
  875. >
  876. {steps.map((step, index) => {
  877. const lit =
  878. fill > 0 && fill >= (line?.stops[index] ?? 1) - 0.02;
  879. return (
  880. <li
  881. key={step.title}
  882. className="flex gap-5 rounded-3xl border border-(--h-line) bg-(--h-paper) p-7 md:block"
  883. >
  884. <span
  885. className={`${heading} relative z-20 grid size-11 shrink-0 place-items-center rounded-xl text-lg font-extrabold transition-[background-color,color,box-shadow,scale] duration-500 ${
  886. lit
  887. ? 'scale-110 bg-(--h-kunyit) text-(--h-ink) shadow-[0_8px_20px_-6px_rgba(242,179,61,0.9)]'
  888. : 'bg-(--h-card) text-(--h-muted) ring-2 ring-(--h-line) ring-inset'
  889. }`}
  890. >
  891. {index + 1}
  892. </span>
  893. <div>
  894. <h3
  895. className={`${heading} mt-2 text-xl font-extrabold md:mt-5`}
  896. >
  897. {step.title}
  898. </h3>
  899. <p className="mt-2 leading-relaxed text-(--h-muted)">
  900. {step.text}
  901. </p>
  902. </div>
  903. </li>
  904. );
  905. })}
  906. {/* The line from step 1 to step 3. It fills in pandan green as the visitor scrolls. */}
  907. {line && (
  908. <div
  909. aria-hidden="true"
  910. className="pointer-events-none absolute z-10 overflow-hidden rounded-full bg-(--h-line)"
  911. style={
  912. line.vertical
  913. ? {
  914. left: line.x1 - 1.5,
  915. top: line.y1,
  916. width: 3,
  917. height: line.y2 - line.y1,
  918. }
  919. : {
  920. left: line.x1,
  921. top: line.y1 - 1.5,
  922. width: line.x2 - line.x1,
  923. height: 3,
  924. }
  925. }
  926. >
  927. <div
  928. className="size-full bg-(--h-pandan)"
  929. style={{
  930. transformOrigin: line.vertical ? 'top' : 'left',
  931. transform: line.vertical
  932. ? `scaleY(${fill})`
  933. : `scaleX(${fill})`,
  934. }}
  935. />
  936. </div>
  937. )}
  938. </ol>
  939. </Section>
  940. );
  941. }
  942. type StepLine = {
  943. x1: number;
  944. y1: number;
  945. x2: number;
  946. y2: number;
  947. /** Where along the line each step's number sits, from 0 (the first) to 1 (the last). */
  948. stops: number[];
  949. vertical: boolean;
  950. };
  951. function ChatSection() {
  952. const box = useRef<HTMLDivElement>(null);
  953. const seen = useSeen(box, 0.75);
  954. const [still] = useState(lessMotion);
  955. // 1 the merchant's message, 2 the AI typing, 3 its reply, 4 the change waiting for an OK, 5 confirmed.
  956. const [step, setStep] = useState(() => (still ? 5 : 0));
  957. const [round, setRound] = useState(0);
  958. useEffect(() => {
  959. if (!seen || still) {
  960. return;
  961. }
  962. const timers = (
  963. [
  964. [1, 150],
  965. [2, 900],
  966. [3, 2200],
  967. [4, 2900],
  968. [5, 4400],
  969. ] as const
  970. ).map(([value, wait]) => window.setTimeout(() => setStep(value), wait));
  971. return () => timers.forEach((timer) => window.clearTimeout(timer));
  972. }, [seen, still, round]);
  973. const show = (from: number) =>
  974. `transition-[opacity,translate] duration-500 ease-out ${step >= from ? 'opacity-100' : 'translate-y-3 opacity-0'}`;
  975. return (
  976. <Section className="py-24">
  977. <div className="grid items-center gap-12 lg:grid-cols-2">
  978. <div data-reveal>
  979. <Kicker>Change anything by chat</Kicker>
  980. <Title>Just say what you want. You stay in charge.</Title>
  981. <p className="mt-5 max-w-lg text-lg leading-relaxed text-(--h-muted)">
  982. Ask in English or Bahasa Malaysia: a new colour, a sale
  983. for Raya, a bundle, product descriptions, a video. The
  984. AI prepares it, and anything that touches your prices,
  985. products or discounts waits for your OK.
  986. </p>
  987. <ul className="mt-6 space-y-2.5">
  988. {[
  989. '"Make the main colour dark green"',
  990. '"Buat kod RAYA10, 10% sampai hujung bulan"',
  991. '"Write descriptions for my new products"',
  992. ].map((example) => (
  993. <li
  994. key={example}
  995. className="w-fit rounded-full bg-(--h-pandan-soft) px-4 py-1.5 text-sm font-medium text-(--h-pandan-deep)"
  996. >
  997. {example}
  998. </li>
  999. ))}
  1000. </ul>
  1001. </div>
  1002. <div
  1003. ref={box}
  1004. data-reveal
  1005. style={revealDelay(1)}
  1006. className="rounded-3xl border border-(--h-line) bg-(--h-card) p-5 shadow-[0_25px_50px_-25px_rgba(16,36,28,0.35)] sm:p-7"
  1007. aria-label="Example of a chat with the AI"
  1008. >
  1009. <div
  1010. className={`ml-auto w-fit max-w-[85%] rounded-2xl rounded-br-sm bg-(--h-ink) px-4 py-3 text-sm text-white ${show(1)}`}
  1011. >
  1012. Buat kod RAYA10, 10% sampai hujung bulan
  1013. </div>
  1014. <div className="mt-4 flex gap-3">
  1015. <span
  1016. className={`grid size-8 shrink-0 place-items-center rounded-full bg-(--h-kunyit) ${show(2)}`}
  1017. >
  1018. <Sparkles className="size-4" aria-hidden="true" />
  1019. </span>
  1020. <div className="min-w-0 flex-1 space-y-3">
  1021. <div className="relative">
  1022. <p
  1023. className={`rounded-2xl rounded-tl-sm bg-(--h-paper) px-4 py-3 text-sm ${show(3)}`}
  1024. >
  1025. Saya dah sediakan kod RAYA10. Sila sahkan di
  1026. bawah.
  1027. </p>
  1028. {step === 2 && (
  1029. <span
  1030. aria-hidden="true"
  1031. className="absolute top-0 left-0 flex h-11 items-center gap-1.5 rounded-2xl rounded-tl-sm bg-(--h-paper) px-4"
  1032. >
  1033. {[0, 150, 300].map((wait) => (
  1034. <span
  1035. key={wait}
  1036. className="h-dot size-1.5 rounded-full bg-(--h-muted)"
  1037. style={{
  1038. animationDelay: `${wait}ms`,
  1039. }}
  1040. />
  1041. ))}
  1042. </span>
  1043. )}
  1044. </div>
  1045. <div
  1046. className={`rounded-2xl border border-(--h-line) p-4 text-sm ${show(4)}`}
  1047. >
  1048. <p
  1049. className={`text-xs font-semibold transition-colors ${step >= 5 ? 'text-(--h-pandan)' : 'text-(--h-muted)'}`}
  1050. >
  1051. {step >= 5
  1052. ? 'Confirmed. RAYA10 is live in your store.'
  1053. : 'Waiting for your OK'}
  1054. </p>
  1055. <p className="mt-2">
  1056. Create the discount code{' '}
  1057. <span className="font-semibold">
  1058. RAYA10
  1059. </span>
  1060. : 10% off, until the end of the month
  1061. </p>
  1062. <div className="mt-3 flex gap-2">
  1063. <span
  1064. className={`inline-flex items-center gap-1 rounded-lg bg-(--h-pandan) px-3 py-1.5 text-xs font-semibold text-white transition-shadow duration-300 ${step >= 5 ? 'ring-4 ring-(--h-pandan)/25' : ''}`}
  1065. >
  1066. {step >= 5 && (
  1067. <Check
  1068. className="size-3.5"
  1069. aria-hidden="true"
  1070. />
  1071. )}
  1072. Confirm
  1073. </span>
  1074. <span className="rounded-lg border border-(--h-line) px-3 py-1.5 text-xs font-semibold">
  1075. Cancel
  1076. </span>
  1077. </div>
  1078. </div>
  1079. </div>
  1080. </div>
  1081. {!still && (
  1082. <div className="mt-3 flex justify-end">
  1083. <button
  1084. type="button"
  1085. onClick={() => {
  1086. setStep(0);
  1087. setRound((count) => count + 1);
  1088. }}
  1089. className={`text-xs font-semibold text-(--h-muted) transition-opacity hover:text-(--h-ink) ${step >= 5 ? 'opacity-100' : 'pointer-events-none opacity-0'}`}
  1090. tabIndex={step >= 5 ? 0 : -1}
  1091. >
  1092. Play again
  1093. </button>
  1094. </div>
  1095. )}
  1096. </div>
  1097. </div>
  1098. </Section>
  1099. );
  1100. }
  1101. type Look = {
  1102. name: string;
  1103. note: string;
  1104. /** The small sample card the visitor clicks. */
  1105. card: string;
  1106. title: string;
  1107. button: string;
  1108. /** The big sample store: its page, banner and product tiles. */
  1109. page: string;
  1110. hero: string;
  1111. tile: string;
  1112. };
  1113. /** The six ready-made looks, each drawn in its own style. */
  1114. const looks: Look[] = [
  1115. {
  1116. name: 'Minimal',
  1117. note: 'Clean and quiet',
  1118. card: 'bg-white text-[#1d1d1d] rounded-md',
  1119. title: 'font-sans font-semibold tracking-tight',
  1120. button: 'bg-[#1d1d1d] text-white rounded',
  1121. page: 'bg-white text-[#1d1d1d]',
  1122. hero: 'bg-[#f1f1f1] rounded-md',
  1123. tile: 'bg-[#f6f6f6] rounded-md',
  1124. },
  1125. {
  1126. name: 'Soft',
  1127. note: 'Rounded and friendly',
  1128. card: 'bg-[#FFF4EC] text-[#4a2e22] rounded-3xl shadow-md',
  1129. title: 'font-sans font-bold',
  1130. button: 'bg-[#E27D60] text-white rounded-full',
  1131. page: 'bg-[#FFF4EC] text-[#4a2e22]',
  1132. hero: 'bg-[#FBDCCB] rounded-3xl',
  1133. tile: 'bg-white rounded-3xl shadow-md',
  1134. },
  1135. {
  1136. name: 'Elegant',
  1137. note: 'Serif and premium',
  1138. card: 'bg-[#F5EFE6] text-[#2b2420] rounded-none',
  1139. title: 'font-serif tracking-[0.12em] uppercase',
  1140. button: 'border border-[#2b2420] rounded-none',
  1141. page: 'bg-[#F5EFE6] text-[#2b2420]',
  1142. hero: 'bg-[#E7DCCB] rounded-none',
  1143. tile: 'bg-[#FBF7F1] rounded-none',
  1144. },
  1145. {
  1146. name: 'Bold',
  1147. note: 'Loud and heavy',
  1148. card: 'bg-[#FFE14D] text-black rounded-none border-2 border-black shadow-[5px_5px_0_#000]',
  1149. title: 'font-sans font-black uppercase',
  1150. button: 'bg-[#FFE14D] text-black rounded-none border-2 border-[#FFE14D]',
  1151. page: 'bg-[#FFE14D] text-black',
  1152. hero: 'bg-black text-[#FFE14D] rounded-none',
  1153. tile: 'bg-white rounded-none border-2 border-black shadow-[4px_4px_0_#000]',
  1154. },
  1155. {
  1156. name: 'Playful',
  1157. note: 'Round and lively',
  1158. card: 'bg-[#E8F1FF] text-[#1b2a4a] rounded-[28px] shadow-md',
  1159. title: 'font-sans font-black',
  1160. button: 'bg-[#3D6DF2] text-white rounded-full shadow-[2px_2px_0_#1b2a4a]',
  1161. page: 'bg-[#E8F1FF] text-[#1b2a4a]',
  1162. hero: 'bg-[#C9DBFF] rounded-[28px]',
  1163. tile: 'bg-white rounded-[22px] shadow-md',
  1164. },
  1165. {
  1166. name: 'Classic',
  1167. note: 'Simple and safe',
  1168. card: 'bg-white text-[#24323a] rounded-xl border border-[#dfe6ea]',
  1169. title: 'font-sans font-semibold',
  1170. button: 'bg-[#24323a] text-white rounded-lg',
  1171. page: 'bg-white text-[#24323a]',
  1172. hero: 'bg-[#EEF3F5] rounded-xl',
  1173. tile: 'bg-white rounded-xl border border-[#dfe6ea]',
  1174. },
  1175. ];
  1176. /** How long each look shows before the next one, in milliseconds. */
  1177. const lookTime = 3200;
  1178. /**
  1179. * One sample store that changes look every few seconds, to show that the same store can look many ways.
  1180. * Clicking a look shows it and stops the changing.
  1181. */
  1182. function Styles() {
  1183. const box = useRef<HTMLDivElement>(null);
  1184. const seen = useSeen(box, 0.8);
  1185. const [active, setActive] = useState(0);
  1186. const [auto, setAuto] = useState(() => !lessMotion());
  1187. const playing = auto && seen;
  1188. const look = looks[active];
  1189. useEffect(() => {
  1190. if (!playing) {
  1191. return;
  1192. }
  1193. const timer = window.setTimeout(
  1194. () => setActive((current) => (current + 1) % looks.length),
  1195. lookTime,
  1196. );
  1197. return () => window.clearTimeout(timer);
  1198. }, [playing, active]);
  1199. return (
  1200. <Section className="bg-(--h-pandan-deep) py-24 text-white">
  1201. <div data-reveal className="max-w-2xl">
  1202. <p className="text-sm font-semibold tracking-wide text-(--h-kunyit) uppercase">
  1203. Looks like your brand
  1204. </p>
  1205. <Title className="text-white">
  1206. Six ready-made styles. Your colours. Twenty fonts.
  1207. </Title>
  1208. <p className="mt-5 text-lg leading-relaxed text-white/75">
  1209. The AI picks the style that fits your brand. A fashion store
  1210. and a sambal store will not look alike. Switch with one
  1211. click, or fine-tune buttons, cards, spacing and motion.
  1212. </p>
  1213. </div>
  1214. <div
  1215. ref={box}
  1216. data-reveal
  1217. style={revealDelay(1)}
  1218. className="mt-12 grid items-center gap-8 lg:grid-cols-[1.25fr_1fr]"
  1219. >
  1220. {/* The sample store, drawn in the chosen look. */}
  1221. <div
  1222. aria-hidden="true"
  1223. className="relative overflow-hidden rounded-2xl bg-white shadow-2xl"
  1224. >
  1225. <div className="flex items-center gap-1.5 border-b border-black/10 px-3 py-2">
  1226. <span className="size-2 rounded-full bg-black/15" />
  1227. <span className="size-2 rounded-full bg-black/15" />
  1228. <span className="size-2 rounded-full bg-black/15" />
  1229. <span className="ml-2 rounded-md bg-black/5 px-2 py-0.5 text-[10px] text-black/55">
  1230. sambal-mak-teh
  1231. </span>
  1232. <span
  1233. key={look.name}
  1234. className="h-pop ml-auto rounded-full bg-(--h-kunyit) px-2.5 py-0.5 text-[10px] font-bold text-(--h-ink)"
  1235. >
  1236. Style: {look.name}
  1237. </span>
  1238. </div>
  1239. <div
  1240. className={`p-4 transition-colors duration-500 sm:p-6 ${look.page}`}
  1241. >
  1242. <div className="flex items-center justify-between">
  1243. <span className={`text-sm ${look.title}`}>
  1244. Mak Teh
  1245. </span>
  1246. <span className="text-[11px] opacity-60">
  1247. Shop · About · Cart
  1248. </span>
  1249. </div>
  1250. <div
  1251. className={`mt-4 px-5 py-7 transition-all duration-500 sm:px-7 sm:py-9 ${look.hero}`}
  1252. >
  1253. <p className="text-[10px] tracking-[0.2em] uppercase opacity-70">
  1254. Kelantan kitchen
  1255. </p>
  1256. <p
  1257. className={`mt-2 text-2xl leading-tight sm:text-3xl ${look.title}`}
  1258. >
  1259. Sambal made the slow way
  1260. </p>
  1261. <span
  1262. className={`mt-4 inline-block px-4 py-2 text-xs font-semibold transition-all duration-500 ${look.button}`}
  1263. >
  1264. Shop now
  1265. </span>
  1266. </div>
  1267. <div className="mt-4 grid grid-cols-3 gap-3">
  1268. {[
  1269. {
  1270. name: 'Sambal tumis',
  1271. price: 'RM 14.90',
  1272. colour: '#B4361E',
  1273. },
  1274. {
  1275. name: 'Serunding',
  1276. price: 'RM 18.90',
  1277. colour: '#8A5A2B',
  1278. },
  1279. {
  1280. name: 'Budu',
  1281. price: 'RM 9.90',
  1282. colour: '#5B3A1C',
  1283. },
  1284. ].map((product) => (
  1285. <div
  1286. key={product.name}
  1287. className={`overflow-hidden transition-all duration-500 ${look.tile}`}
  1288. >
  1289. <div className="grid aspect-[4/3] place-items-center bg-[#F6E7D3]">
  1290. <span
  1291. className="block h-9 w-7 rounded-t-md rounded-b-lg"
  1292. style={{
  1293. background: product.colour,
  1294. }}
  1295. />
  1296. </div>
  1297. <p className="truncate px-2 pt-2 text-[11px] font-semibold">
  1298. {product.name}
  1299. </p>
  1300. <p className="px-2 pb-2 text-[11px] opacity-70">
  1301. {product.price}
  1302. </p>
  1303. </div>
  1304. ))}
  1305. </div>
  1306. </div>
  1307. </div>
  1308. {/* The six looks. The one showing has a ring and, while they change by themselves, a timer bar. */}
  1309. <ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-2">
  1310. {looks.map((item, index) => (
  1311. <li key={item.name}>
  1312. <button
  1313. type="button"
  1314. aria-pressed={index === active}
  1315. onClick={() => {
  1316. setActive(index);
  1317. setAuto(false);
  1318. }}
  1319. className={`relative flex h-24 w-full flex-col justify-between overflow-hidden p-4 text-left transition-[opacity,box-shadow,translate] duration-300 sm:h-28 ${item.card} ${
  1320. index === active
  1321. ? 'ring-4 ring-(--h-kunyit) ring-offset-2 ring-offset-(--h-pandan-deep)'
  1322. : 'opacity-75 hover:opacity-100 motion-safe:hover:-translate-y-0.5'
  1323. }`}
  1324. >
  1325. <span className="text-xs opacity-60">
  1326. {item.note}
  1327. </span>
  1328. <span className={`text-base ${item.title}`}>
  1329. {item.name}
  1330. </span>
  1331. {playing && index === active && (
  1332. <span
  1333. key={`${active}-bar`}
  1334. className="h-bar absolute bottom-0 left-0 h-1 bg-current opacity-40"
  1335. style={{
  1336. animationDuration: `${lookTime}ms`,
  1337. }}
  1338. />
  1339. )}
  1340. </button>
  1341. </li>
  1342. ))}
  1343. </ul>
  1344. </div>
  1345. </Section>
  1346. );
  1347. }
  1348. function Features() {
  1349. const features: { icon: ReactNode; title: string; text: string }[] = [
  1350. {
  1351. icon: <ShieldCheck />,
  1352. title: 'Secure checkout',
  1353. text: 'Shoppers pay on a secure Stripe page. Orders, stock and confirmation emails update by themselves.',
  1354. },
  1355. {
  1356. icon: <Truck />,
  1357. title: 'Shipping across Malaysia',
  1358. text: 'One fee for Peninsular Malaysia, another for Sabah, Sarawak and Labuan, and free shipping over an amount you choose.',
  1359. },
  1360. {
  1361. icon: <MessageCircle />,
  1362. title: 'WhatsApp built in',
  1363. text: 'A chat button on every page, and a link on each product so shoppers can ask before they buy.',
  1364. },
  1365. {
  1366. icon: <Tag />,
  1367. title: 'Codes and sales',
  1368. text: 'Discount codes like RAYA10, and automatic sales like "buy 2, get 10% off", shown in a bar at the top.',
  1369. },
  1370. {
  1371. icon: <Package />,
  1372. title: 'Options and bundles',
  1373. text: 'Sizes and flavours with their own price and stock, and bundles whose stock follows the products inside.',
  1374. },
  1375. {
  1376. icon: <Layers />,
  1377. title: 'Collections',
  1378. text: 'Group products into "Sun care" or "Gift sets", with their own pages and a "shop by" section.',
  1379. },
  1380. {
  1381. icon: <Globe />,
  1382. title: 'English or Bahasa Malaysia',
  1383. text: 'Your store, checkout and messages to shoppers in the language your customers read.',
  1384. },
  1385. {
  1386. icon: <Video />,
  1387. title: 'Your photos and videos',
  1388. text: 'Big photo banners, a second photo on hover, and YouTube or Vimeo videos that load only when played.',
  1389. },
  1390. ];
  1391. return (
  1392. <Section id="features" className="py-24">
  1393. <div data-reveal className="max-w-2xl">
  1394. <Kicker>Made for the way you sell</Kicker>
  1395. <Title>
  1396. Everything a small shop needs, already switched on
  1397. </Title>
  1398. </div>
  1399. <ul className="mt-12 grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
  1400. {features.map((feature, index) => (
  1401. <li
  1402. key={feature.title}
  1403. data-reveal
  1404. style={revealDelay(index % 4)}
  1405. className="rounded-3xl border border-(--h-line) bg-(--h-card) p-6 transition-transform motion-safe:hover:-translate-y-1"
  1406. >
  1407. <span className="grid size-11 place-items-center rounded-xl bg-(--h-pandan-soft) text-(--h-pandan) [&_svg]:size-5">
  1408. {feature.icon}
  1409. </span>
  1410. <h3
  1411. className={`${heading} mt-5 text-lg font-extrabold`}
  1412. >
  1413. {feature.title}
  1414. </h3>
  1415. <p className="mt-2 text-sm leading-relaxed text-(--h-muted)">
  1416. {feature.text}
  1417. </p>
  1418. </li>
  1419. ))}
  1420. </ul>
  1421. <p className="mt-6 flex items-center gap-2 text-sm text-(--h-muted)">
  1422. <Palette className="size-4" aria-hidden="true" />
  1423. Every store also gets a photo hero, trust points, an FAQ, a
  1424. phone menu and an add-to-cart bar on phones.
  1425. </p>
  1426. </Section>
  1427. );
  1428. }
  1429. function Pricing({ plans, trialDays }: { plans: Plan[]; trialDays: number }) {
  1430. const start = useStartUrl();
  1431. const paid = plans.filter((plan) => plan.price > 0);
  1432. const trial = plans.find((plan) => plan.price === 0);
  1433. const limits = (plan: Plan) => {
  1434. const per = plan.period === 'month' ? 'a month' : 'in total';
  1435. return [
  1436. `${plan.stores} ${plan.stores === 1 ? 'store' : 'stores'}`,
  1437. `${plan.regenerations} full redesigns ${per}`,
  1438. `${plan.edits.toLocaleString('en-MY')} AI changes ${per}`,
  1439. ];
  1440. };
  1441. return (
  1442. <Section id="pricing" className="bg-(--h-card) py-24">
  1443. <div data-reveal className="mx-auto max-w-2xl text-center">
  1444. <Kicker>Pricing</Kicker>
  1445. <Title>Start free. Pay when your shop is ready.</Title>
  1446. <p className="mt-5 text-lg text-(--h-muted)">
  1447. Every plan has every selling feature. Plans differ in how
  1448. many stores you run and how much you use the AI.
  1449. </p>
  1450. </div>
  1451. {trial && (
  1452. <div
  1453. data-reveal
  1454. className="mx-auto mt-10 flex max-w-4xl flex-wrap items-center justify-between gap-4 rounded-2xl bg-(--h-kunyit-soft) px-6 py-4"
  1455. >
  1456. <p>
  1457. <span className="font-semibold">
  1458. {trial.name}: free for {trialDays} days.
  1459. </span>{' '}
  1460. <span className="text-(--h-muted)">
  1461. {limits(trial).join(' · ')}. No card needed.
  1462. </span>
  1463. </p>
  1464. <Link
  1465. href={start}
  1466. className="rounded-full bg-(--h-ink) px-5 py-2 text-sm font-semibold text-white hover:bg-(--h-pandan-deep)"
  1467. >
  1468. Start free
  1469. </Link>
  1470. </div>
  1471. )}
  1472. <ul className="mx-auto mt-6 grid max-w-4xl gap-5 md:grid-cols-3">
  1473. {paid.map((plan, index) => {
  1474. const featured = index === 1;
  1475. return (
  1476. <li
  1477. key={plan.key}
  1478. data-reveal
  1479. style={revealDelay(index + 1)}
  1480. className={`relative flex flex-col rounded-3xl p-7 transition-[translate,box-shadow] duration-300 ease-out hover:z-10 hover:shadow-[0_35px_70px_-30px_rgba(16,36,28,0.45)] motion-safe:hover:-translate-y-2 ${
  1481. featured
  1482. ? 'bg-(--h-pandan-deep) text-white shadow-xl md:-my-3 md:py-10'
  1483. : 'border border-(--h-line) bg-(--h-paper)'
  1484. }`}
  1485. >
  1486. {featured && (
  1487. <span className="absolute -top-3 left-7 rounded-full bg-(--h-kunyit) px-3 py-1 text-xs font-bold text-(--h-ink)">
  1488. For growing brands
  1489. </span>
  1490. )}
  1491. <h3 className={`${heading} text-xl font-extrabold`}>
  1492. {plan.name}
  1493. </h3>
  1494. <p className="mt-4 flex items-baseline gap-1">
  1495. <span
  1496. className={`${heading} text-4xl font-extrabold`}
  1497. >
  1498. RM {plan.price.toLocaleString('en-MY')}
  1499. </span>
  1500. <span
  1501. className={
  1502. featured
  1503. ? 'text-white/70'
  1504. : 'text-(--h-muted)'
  1505. }
  1506. >
  1507. / month
  1508. </span>
  1509. </p>
  1510. <ul className="mt-6 flex-1 space-y-2.5 text-sm">
  1511. {limits(plan).map((limit) => (
  1512. <li key={limit} className="flex gap-2.5">
  1513. <Check
  1514. className={`size-4 shrink-0 ${featured ? 'text-(--h-kunyit)' : 'text-(--h-pandan)'}`}
  1515. aria-hidden="true"
  1516. />
  1517. {limit}
  1518. </li>
  1519. ))}
  1520. <li className="flex gap-2.5">
  1521. <Check
  1522. className={`size-4 shrink-0 ${featured ? 'text-(--h-kunyit)' : 'text-(--h-pandan)'}`}
  1523. aria-hidden="true"
  1524. />
  1525. Every selling feature
  1526. </li>
  1527. </ul>
  1528. <Link
  1529. href={start}
  1530. className={`mt-8 rounded-full px-5 py-2.5 text-center font-semibold ${
  1531. featured
  1532. ? 'bg-(--h-kunyit) text-(--h-ink) hover:bg-white'
  1533. : 'border border-(--h-ink) hover:bg-(--h-ink) hover:text-white'
  1534. }`}
  1535. >
  1536. Start with the free trial
  1537. </Link>
  1538. </li>
  1539. );
  1540. })}
  1541. </ul>
  1542. <p className="mt-8 text-center text-sm text-(--h-muted)">
  1543. Prices in ringgit. Cancel any time from your Billing page.
  1544. </p>
  1545. </Section>
  1546. );
  1547. }
  1548. function Faq({ trialDays }: { trialDays: number }) {
  1549. const questions = [
  1550. {
  1551. q: 'Do I need a designer or any technical skills?',
  1552. a: 'No. You describe your brand in your own words and the AI designs the store. You add products with a simple form, and change the design with buttons or by chat.',
  1553. },
  1554. {
  1555. q: 'Will my store look like everyone else’s?',
  1556. a: 'No. The AI picks colours, fonts, a style and sections to suit your category and your words, and it is told not to repeat your other stores. You can also switch between six ready-made looks.',
  1557. },
  1558. {
  1559. q: 'Can the AI change my prices or products without asking?',
  1560. a: 'No. Anything that touches products, prices, stock or discounts is shown to you first, and nothing changes until you press Confirm.',
  1561. },
  1562. {
  1563. q: 'How do shoppers pay?',
  1564. a: 'On a secure Stripe checkout page. Orders, stock and confirmation emails update by themselves once a payment goes through.',
  1565. },
  1566. {
  1567. q: 'Can my store be in Bahasa Malaysia?',
  1568. a: 'Yes. Choose English or Bahasa Malaysia when you create the store, and the AI writes it in that language. You can chat with the AI in either.',
  1569. },
  1570. {
  1571. q: 'Can I use my own domain name?',
  1572. a: 'Not yet. Every store gets its own address on our domain today, and your own domain is on our list.',
  1573. },
  1574. {
  1575. q: 'What happens after the free trial?',
  1576. a: `You get ${trialDays} days to try everything. After that, choose a plan on the Billing page to keep using the AI and keep your store online.`,
  1577. },
  1578. ];
  1579. return (
  1580. <Section id="faq" className="py-24">
  1581. <div className="grid gap-10 lg:grid-cols-[1fr_1.6fr]">
  1582. <div data-reveal>
  1583. <Kicker>Questions</Kicker>
  1584. <Title>Good to know</Title>
  1585. </div>
  1586. <div
  1587. data-reveal
  1588. style={revealDelay(1)}
  1589. className="divide-y divide-(--h-line) border-y border-(--h-line)"
  1590. >
  1591. {questions.map((item) => (
  1592. <details key={item.q} className="group py-5">
  1593. <summary className="flex cursor-pointer list-none items-center justify-between gap-4 text-lg font-semibold [&::-webkit-details-marker]:hidden">
  1594. {item.q}
  1595. <ChevronDown
  1596. className="size-5 shrink-0 text-(--h-muted) transition-transform group-open:rotate-180"
  1597. aria-hidden="true"
  1598. />
  1599. </summary>
  1600. <p className="mt-3 max-w-2xl leading-relaxed text-(--h-muted)">
  1601. {item.a}
  1602. </p>
  1603. </details>
  1604. ))}
  1605. </div>
  1606. </div>
  1607. </Section>
  1608. );
  1609. }
  1610. function FinalCall({ trialDays }: { trialDays: number }) {
  1611. const start = useStartUrl();
  1612. return (
  1613. <Section className="pb-24">
  1614. <div
  1615. data-reveal
  1616. className="relative overflow-hidden rounded-[2rem] bg-(--h-kunyit) px-7 py-14 text-center sm:px-12"
  1617. >
  1618. <div
  1619. aria-hidden="true"
  1620. className="absolute -right-16 -bottom-24 size-72 rounded-full bg-(--h-bunga)/25"
  1621. />
  1622. <div
  1623. aria-hidden="true"
  1624. className="absolute -top-20 -left-10 size-56 rounded-full bg-white/30"
  1625. />
  1626. <h2
  1627. className={`${heading} relative mx-auto max-w-2xl text-3xl leading-tight font-extrabold text-balance sm:text-5xl`}
  1628. >
  1629. Your brand deserves a proper store.
  1630. </h2>
  1631. <p className="relative mx-auto mt-4 max-w-lg text-lg">
  1632. Describe it today, and see it designed in minutes. Free for{' '}
  1633. {trialDays} days.
  1634. </p>
  1635. <Link
  1636. href={start}
  1637. className="relative mt-8 inline-flex items-center gap-2 rounded-full bg-(--h-ink) px-7 py-3.5 font-semibold text-white hover:bg-(--h-pandan-deep)"
  1638. >
  1639. Start free
  1640. <ArrowRight className="size-4" aria-hidden="true" />
  1641. </Link>
  1642. </div>
  1643. </Section>
  1644. );
  1645. }
  1646. function Footer() {
  1647. return (
  1648. <footer className="border-t border-(--h-line) px-5 py-10 sm:px-8">
  1649. <div className="mx-auto flex w-full max-w-6xl flex-col gap-6 text-sm text-(--h-muted) sm:flex-row sm:items-center sm:justify-between">
  1650. <Logo />
  1651. <nav aria-label="Footer" className="flex flex-wrap gap-6">
  1652. <a href="#how" className="hover:text-(--h-ink)">
  1653. How it works
  1654. </a>
  1655. <a href="#pricing" className="hover:text-(--h-ink)">
  1656. Pricing
  1657. </a>
  1658. <a href="#faq" className="hover:text-(--h-ink)">
  1659. Questions
  1660. </a>
  1661. <Link href={terms()} className="hover:text-(--h-ink)">
  1662. Terms
  1663. </Link>
  1664. <Link href={privacy()} className="hover:text-(--h-ink)">
  1665. Privacy
  1666. </Link>
  1667. <Link href={login()} className="hover:text-(--h-ink)">
  1668. Log in
  1669. </Link>
  1670. </nav>
  1671. <p>
  1672. © {new Date().getFullYear()} AI Commerce. Made in Malaysia.
  1673. </p>
  1674. </div>
  1675. </footer>
  1676. );
  1677. }