@tanqory/partner-cli 0.1.0-alpha.0 → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,12 @@
1
- /** The theme settings (the editor's Theme panel). Replace with your theme's own. */
1
+ /**
2
+ * The theme settings (the editor's Theme panel): the colours a merchant can change. Each one becomes a CSS variable on
3
+ * the page (theme.tsx themeVars), so a change in the editor recolours the whole theme. Replace with the
4
+ * theme's own, and keep every colour the design uses here, never only in theme.css.
5
+ */
2
6
  import { defineSettings } from '@tanqory/theme-kit/headless'
3
7
 
4
8
  export const settings = defineSettings({
5
- scheme: {
6
- type: 'select',
7
- label: 'Colour scheme',
8
- group: 'Colours',
9
- default: 'light',
10
- options: [
11
- { value: 'light', label: 'Light' },
12
- { value: 'dark', label: 'Dark' },
13
- ],
14
- },
9
+ colorBackground: { type: 'color', label: 't:labels.background', group: 't:labels.colours', default: '#ffffff' },
10
+ colorText: { type: 'color', label: 't:labels.text', group: 't:labels.colours', default: '#1f2328' },
11
+ colorAccent: { type: 'color', label: 't:labels.buttons_and_links', group: 't:labels.colours', default: '#1f2328' },
15
12
  })
@@ -3,19 +3,18 @@
3
3
  :root {
4
4
  --st-ink: #1f2328;
5
5
  --st-bg: #ffffff;
6
- --st-panel: #f5f5f4;
7
6
  --st-accent: #1f2328;
8
- --st-muted: #57606a;
9
- --st-line: #d0d7de;
7
+ /* derived from the merchant's three colours (src/settings.ts), so they follow every change */
8
+ --st-panel: color-mix(in srgb, var(--st-ink) 5%, var(--st-bg));
9
+ --st-muted: color-mix(in srgb, var(--st-ink) 68%, var(--st-bg));
10
+ --st-line: color-mix(in srgb, var(--st-ink) 18%, var(--st-bg));
10
11
  --st-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
11
12
  --st-gutter: clamp(16px, 4vw, 32px);
12
13
  }
13
14
  * { box-sizing: border-box; }
14
15
  html, body { margin: 0; background: var(--st-bg); }
15
16
  body { color: var(--st-ink); font-family: var(--st-font); line-height: 1.6; -webkit-font-smoothing: antialiased; }
16
- body:has(.st--dark) { background: #111315; }
17
17
  .st { min-height: 100vh; background: var(--st-bg); color: var(--st-ink); }
18
- .st--dark { --st-ink: #f2f2f2; --st-bg: #111315; --st-panel: #1b1e21; --st-accent: #f2f2f2; --st-muted: #a8b0b8; --st-line: #30363d; }
19
18
  .tq-node { display: contents; }
20
19
  .st a { color: var(--st-accent); }
21
20
  .st :focus-visible { outline: 2px solid var(--st-accent); outline-offset: 3px; }
@@ -41,7 +40,7 @@ main#main:focus { outline: none; }
41
40
  .st-mast { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 32px; padding: 16px var(--st-gutter); border-bottom: 1px solid var(--st-line); }
42
41
  .st-mast__brand { display: inline-flex; align-items: center; min-height: 44px; color: var(--st-accent); font-size: 24px; font-style: italic; text-decoration: none; }
43
42
  .st-mast__logo { max-height: 40px; width: auto; height: auto; }
44
- .st-mast__tagline { display: none; }
43
+ .st-mast__tagline { grid-column: 1 / -1; order: -1; margin: 0; color: var(--st-muted); font-size: 12px; text-align: center; }
45
44
  .st-mast__menu { display: none; }
46
45
  .st-mast__nav ul { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
47
46
  .st .st-mast__nav a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--st-ink); font-size: 13px; text-decoration: none; }
@@ -84,6 +83,24 @@ main#main:focus { outline: none; }
84
83
  .st-card__price { color: var(--st-muted); font-size: 15px; }
85
84
  .st-card__flag { color: var(--st-accent); }
86
85
 
86
+ /* ── features, testimonials (blocks) ─────────────────────────────────────── */
87
+ .st-features, .st-quotes { padding: 64px var(--st-gutter); }
88
+ .st-features__title, .st-quotes__title { margin-bottom: 32px; font-size: clamp(28px, 4vw, 40px); }
89
+ .st-features__list, .st-quotes__list { display: grid; gap: 32px; list-style: none; margin: 0; padding: 0; }
90
+ .st-features__list--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
91
+ .st-features__list--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
92
+ .st-features__list--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
93
+ .st-features__item { display: flex; flex-direction: column; gap: 10px; }
94
+ .st-features__img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--st-panel); }
95
+ .st-features__name { font-size: 20px; }
96
+ .st-features__text { margin: 0; color: var(--st-muted); }
97
+ .st-features__link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
98
+ .st-quotes { background: var(--st-panel); }
99
+ .st-quotes__list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
100
+ .st-quotes__figure { margin: 0; display: flex; flex-direction: column; gap: 16px; }
101
+ .st-quotes__text { margin: 0; font-size: 20px; line-height: 1.45; }
102
+ .st-quotes__who { font-size: 14px; }
103
+
87
104
  /* ── note, letters ───────────────────────────────────────────────────────── */
88
105
  .st-note { max-width: 760px; margin: 0 auto; text-align: center; }
89
106
  .st-note__body { margin-top: 20px; color: var(--st-muted); font-size: 19px; }
@@ -3,10 +3,10 @@
3
3
  * every storefront function (cart, consent, money, translations, images) comes from the kit. Replace all of it.
4
4
  */
5
5
  import type { ReactNode } from 'react'
6
- import { CartDrawer, CartLine, CartLineRemove, CheckoutButton, ConsentBanner, Image, SkipLink, defineTheme, formatMoney, useSettings, useTranslate } from '@tanqory/theme-kit/headless'
6
+ import { CartDrawer, CartLine, CartLineRemove, CheckoutButton, ConsentBanner, Image, SkipLink, defineTheme, formatMoney, sx, useSettings, useTranslate } from '@tanqory/theme-kit/headless'
7
7
  import { cx } from './components/parts'
8
8
  import { footer, header } from './sections/chrome'
9
- import { featuredCollection, hero, letters, note } from './sections/editorial'
9
+ import { featuredCollection, features, hero, letters, note, testimonials } from './sections/editorial'
10
10
  import { account, cart, collection, product, recommendations, search } from './sections/commerce'
11
11
  import { article, blog, contact, notFound, page } from './sections/content'
12
12
 
@@ -57,10 +57,20 @@ function Drawer(): JSX.Element {
57
57
  )
58
58
  }
59
59
 
60
+ /**
61
+ * The merchant's colours (the editor's Theme panel, src/settings.ts) become CSS variables on the page's root, as a class:
62
+ * the storefront CSP forbids style attributes, so sx() turns them into a rule. Every colour in theme.css reads them.
63
+ */
64
+ function themeVars(settings: Readonly<Record<string, unknown>>): string | undefined {
65
+ const color = (key: string): string | undefined => (typeof settings[key] === 'string' && /^#[0-9a-f]{6}$/i.test(settings[key] as string) ? (settings[key] as string) : undefined)
66
+ const vars = { '--st-bg': color('colorBackground'), '--st-ink': color('colorText'), '--st-accent': color('colorAccent') }
67
+ return sx(Object.fromEntries(Object.entries(vars).filter(([, v]) => v)))
68
+ }
69
+
60
70
  function Layout({ children }: { children: ReactNode }): JSX.Element {
61
71
  const settings = useSettings()
62
72
  return (
63
- <div className={cx('st', settings.scheme === 'dark' && 'st--dark')}>
73
+ <div className={cx('st', themeVars(settings))}>
64
74
  <SkipLink className="st-skip" />
65
75
  {children}
66
76
  <Drawer />
@@ -71,6 +81,6 @@ function Layout({ children }: { children: ReactNode }): JSX.Element {
71
81
 
72
82
  export default defineTheme({
73
83
  name: 'Partner starter',
74
- sections: [header, hero, featuredCollection, note, letters, product, recommendations, collection, search, cart, page, contact, blog, article, account, notFound, footer],
84
+ sections: [header, hero, featuredCollection, features, testimonials, note, letters, product, recommendations, collection, search, cart, page, contact, blog, article, account, notFound, footer],
75
85
  Layout,
76
86
  })
@@ -8,8 +8,9 @@
8
8
  "id": "hero-1",
9
9
  "type": "hero",
10
10
  "settings": {
11
- "kicker": "Welcome",
12
- "heading": "Our shop",
11
+ "kicker": "New season",
12
+ "heading": "Made to be used every day",
13
+ "body": "<p>Simple things, made well and made to last.</p>",
13
14
  "buttonLabel": "Shop all",
14
15
  "buttonLink": "/collections/all"
15
16
  }
@@ -18,17 +19,96 @@
18
19
  "id": "shelf-1",
19
20
  "type": "featured-collection",
20
21
  "settings": {
21
- "heading": "Products",
22
- "collection": "all"
22
+ "heading": "Featured products",
23
+ "collection": "all",
24
+ "count": 8
23
25
  }
24
26
  },
27
+ {
28
+ "id": "features-1",
29
+ "type": "features",
30
+ "settings": {
31
+ "heading": "Why shop with us",
32
+ "columns": "3"
33
+ },
34
+ "blocks": [
35
+ {
36
+ "id": "feature-1",
37
+ "type": "feature",
38
+ "settings": {
39
+ "heading": "Free delivery",
40
+ "text": "On every order over 1,000 baht."
41
+ }
42
+ },
43
+ {
44
+ "id": "feature-2",
45
+ "type": "feature",
46
+ "settings": {
47
+ "heading": "Easy returns",
48
+ "text": "Send it back within 30 days, no questions asked."
49
+ }
50
+ },
51
+ {
52
+ "id": "feature-3",
53
+ "type": "feature",
54
+ "settings": {
55
+ "heading": "Made to last",
56
+ "text": "Good materials, checked by hand before they ship."
57
+ }
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "id": "quotes-1",
63
+ "type": "testimonials",
64
+ "settings": {
65
+ "heading": "What customers say"
66
+ },
67
+ "blocks": [
68
+ {
69
+ "id": "quote-1",
70
+ "type": "testimonial",
71
+ "settings": {
72
+ "quote": "The best thing I bought this year.",
73
+ "name": "Somchai P.",
74
+ "detail": "Bangkok"
75
+ }
76
+ },
77
+ {
78
+ "id": "quote-2",
79
+ "type": "testimonial",
80
+ "settings": {
81
+ "quote": "Arrived in two days, packed with care.",
82
+ "name": "Anna K.",
83
+ "detail": "Chiang Mai"
84
+ }
85
+ },
86
+ {
87
+ "id": "quote-3",
88
+ "type": "testimonial",
89
+ "settings": {
90
+ "quote": "I ordered a second one for my sister.",
91
+ "name": "Nok S.",
92
+ "detail": "Phuket"
93
+ }
94
+ }
95
+ ]
96
+ },
25
97
  {
26
98
  "id": "note-1",
27
- "type": "rich-text"
99
+ "type": "rich-text",
100
+ "settings": {
101
+ "heading": "About us",
102
+ "body": "<p>Tell shoppers who you are and what you make.</p>"
103
+ }
28
104
  },
29
105
  {
30
106
  "id": "letters-1",
31
- "type": "newsletter"
107
+ "type": "newsletter",
108
+ "settings": {
109
+ "heading": "Stay in touch",
110
+ "body": "News and offers, now and then."
111
+ }
32
112
  }
33
113
  ]
34
114
  }
@@ -10,7 +10,11 @@
10
10
  },
11
11
  {
12
12
  "id": "contact-1",
13
- "type": "contact-form"
13
+ "type": "contact-form",
14
+ "settings": {
15
+ "heading": "Contact us",
16
+ "intro": "Write to us and we will answer within one working day."
17
+ }
14
18
  }
15
19
  ]
16
20
  }