@veluai/velu 0.1.0
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.
- package/dist/cli.js +11 -0
- package/package.json +52 -0
- package/runtime/velu-ui/base.css +311 -0
- package/runtime/velu-ui/components/Accordion.jsx +64 -0
- package/runtime/velu-ui/components/ApiClient.jsx +121 -0
- package/runtime/velu-ui/components/ApiField.jsx +87 -0
- package/runtime/velu-ui/components/ApiPath.jsx +63 -0
- package/runtime/velu-ui/components/ApiSidebar.jsx +122 -0
- package/runtime/velu-ui/components/AskBar.jsx +71 -0
- package/runtime/velu-ui/components/Callout.jsx +114 -0
- package/runtime/velu-ui/components/Card.jsx +131 -0
- package/runtime/velu-ui/components/Chatbot.jsx +596 -0
- package/runtime/velu-ui/components/CodeBlock.jsx +375 -0
- package/runtime/velu-ui/components/Columns.jsx +56 -0
- package/runtime/velu-ui/components/Field.jsx +81 -0
- package/runtime/velu-ui/components/Image.jsx +163 -0
- package/runtime/velu-ui/components/MethodBadge.jsx +31 -0
- package/runtime/velu-ui/components/NavSelect.jsx +108 -0
- package/runtime/velu-ui/components/PageFeedback.jsx +219 -0
- package/runtime/velu-ui/components/PageFooter.jsx +213 -0
- package/runtime/velu-ui/components/PageHeader.jsx +414 -0
- package/runtime/velu-ui/components/PageNav.jsx +77 -0
- package/runtime/velu-ui/components/PoweredBy.jsx +51 -0
- package/runtime/velu-ui/components/Prompt.jsx +115 -0
- package/runtime/velu-ui/components/Search.jsx +366 -0
- package/runtime/velu-ui/components/Sidebar.jsx +191 -0
- package/runtime/velu-ui/components/Steps.jsx +65 -0
- package/runtime/velu-ui/components/ThemeToggle.jsx +48 -0
- package/runtime/velu-ui/components/Toc.jsx +537 -0
- package/runtime/velu-ui/components/TocBar.jsx +195 -0
- package/runtime/velu-ui/components/Tree.jsx +87 -0
- package/runtime/velu-ui/components/TryItBar.jsx +90 -0
- package/runtime/velu-ui/components/accordion.css +92 -0
- package/runtime/velu-ui/components/api.css +479 -0
- package/runtime/velu-ui/components/ask-bar.css +94 -0
- package/runtime/velu-ui/components/card.css +105 -0
- package/runtime/velu-ui/components/chatbot.css +617 -0
- package/runtime/velu-ui/components/code-block.css +263 -0
- package/runtime/velu-ui/components/docs-layout.css +775 -0
- package/runtime/velu-ui/components/field.css +82 -0
- package/runtime/velu-ui/components/image.css +237 -0
- package/runtime/velu-ui/components/nav-select.css +157 -0
- package/runtime/velu-ui/components/page-feedback.css +241 -0
- package/runtime/velu-ui/components/page-footer.css +130 -0
- package/runtime/velu-ui/components/page-header.css +520 -0
- package/runtime/velu-ui/components/page-nav.css +50 -0
- package/runtime/velu-ui/components/powered-by.css +66 -0
- package/runtime/velu-ui/components/prompt.css +99 -0
- package/runtime/velu-ui/components/search.css +307 -0
- package/runtime/velu-ui/components/sidebar.css +144 -0
- package/runtime/velu-ui/components/steps.css +77 -0
- package/runtime/velu-ui/components/theme-toggle.css +70 -0
- package/runtime/velu-ui/components/toc-bar.css +234 -0
- package/runtime/velu-ui/components/tree.css +49 -0
- package/runtime/velu-ui/index.js +45 -0
- package/runtime/velu-ui/lib/copyText.js +64 -0
- package/runtime/velu-ui/lib/lang-icons.jsx +156 -0
- package/runtime/velu-ui/lib/prism-langs.js +957 -0
- package/runtime/velu-ui/lib/prism-loader.js +74 -0
- package/runtime/velu-ui/lib/resolveIcon.jsx +29 -0
- package/runtime/velu-ui/lib/scrollIntoNearestView.js +66 -0
- package/runtime/velu-ui/mdx-components.jsx +85 -0
- package/runtime/velu-ui/primitives/Cluster.jsx +49 -0
- package/runtime/velu-ui/primitives/Stack.jsx +63 -0
- package/runtime/velu-ui/primitives/Switcher.jsx +57 -0
- package/runtime/velu-ui/primitives/stack.css +3 -0
- package/runtime/velu-ui/primitives/switcher.css +25 -0
- package/runtime/velu-ui/styles.css +43 -0
- package/runtime/velu-ui/tokens.css +4 -0
- package/schema/velu.schema.json +167 -0
- package/src/navigation.js +434 -0
- package/src/runtime/App.jsx +1473 -0
- package/src/runtime/client-entry.jsx +22 -0
- package/src/runtime/server-entry.jsx +16 -0
- package/src/template.html +48 -0
- package/templates/starter/ai-tools/claude-code.mdx +26 -0
- package/templates/starter/ai-tools/cursor.mdx +17 -0
- package/templates/starter/api-reference/endpoint/create.mdx +24 -0
- package/templates/starter/api-reference/endpoint/get.mdx +27 -0
- package/templates/starter/api-reference/introduction.mdx +28 -0
- package/templates/starter/development.mdx +19 -0
- package/templates/starter/essentials/code.mdx +28 -0
- package/templates/starter/essentials/images.mdx +29 -0
- package/templates/starter/essentials/markdown.mdx +25 -0
- package/templates/starter/essentials/navigation.mdx +39 -0
- package/templates/starter/essentials/settings.mdx +30 -0
- package/templates/starter/favicon.svg +6 -0
- package/templates/starter/index.mdx +31 -0
- package/templates/starter/quickstart.mdx +31 -0
- package/templates/starter/velu.json +33 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChevronDown } from 'lucide-react';
|
|
3
|
+
import resolveIcon from '../lib/resolveIcon.jsx';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NavSelect — a small dropdown for the navigation switchers
|
|
7
|
+
* (product / version / language). Generalized from the mobile drawer's
|
|
8
|
+
* doc-select: a button showing the current value + chevron, opening a
|
|
9
|
+
* menu of link options. Click-outside + Escape close it. The options
|
|
10
|
+
* are LINKS (the active axis is a URL path-prefix), so selecting one
|
|
11
|
+
* navigates via `linkComponent`.
|
|
12
|
+
*
|
|
13
|
+
* @param {{
|
|
14
|
+
* value: string, // label shown on the button
|
|
15
|
+
* options?: Array<{ label, href, icon?, active? }>,
|
|
16
|
+
* icon?: string|React.ReactNode, // optional leading button icon (e.g. 'globe')
|
|
17
|
+
* ariaLabel?: string,
|
|
18
|
+
* size?: 'sm'|'md', // 'sm' = compact (version pill)
|
|
19
|
+
* linkComponent?: React.ElementType,
|
|
20
|
+
* className?: string,
|
|
21
|
+
* }} props
|
|
22
|
+
*/
|
|
23
|
+
export default function NavSelect({
|
|
24
|
+
value,
|
|
25
|
+
valueCode,
|
|
26
|
+
options = [],
|
|
27
|
+
icon,
|
|
28
|
+
ariaLabel = 'Select',
|
|
29
|
+
size = 'md',
|
|
30
|
+
bare = false,
|
|
31
|
+
linkComponent = 'a',
|
|
32
|
+
className = '',
|
|
33
|
+
...rest
|
|
34
|
+
}) {
|
|
35
|
+
const Link = linkComponent;
|
|
36
|
+
const [open, setOpen] = React.useState(false);
|
|
37
|
+
const rootRef = React.useRef(null);
|
|
38
|
+
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (!open) return;
|
|
41
|
+
const onDoc = (e) => {
|
|
42
|
+
if (!rootRef.current?.contains(e.target)) setOpen(false);
|
|
43
|
+
};
|
|
44
|
+
const onKey = (e) => {
|
|
45
|
+
if (e.key === 'Escape') setOpen(false);
|
|
46
|
+
};
|
|
47
|
+
document.addEventListener('mousedown', onDoc);
|
|
48
|
+
document.addEventListener('keydown', onKey);
|
|
49
|
+
return () => {
|
|
50
|
+
document.removeEventListener('mousedown', onDoc);
|
|
51
|
+
document.removeEventListener('keydown', onKey);
|
|
52
|
+
};
|
|
53
|
+
}, [open]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
ref={rootRef}
|
|
58
|
+
className={`velu-nav-select velu-nav-select--${size}${bare ? ' velu-nav-select--bare' : ''} ${className}`.trim()}
|
|
59
|
+
data-open={open ? 'true' : 'false'}
|
|
60
|
+
{...rest}
|
|
61
|
+
>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
className="velu-nav-select__btn"
|
|
65
|
+
aria-haspopup="menu"
|
|
66
|
+
aria-expanded={open}
|
|
67
|
+
aria-label={ariaLabel}
|
|
68
|
+
onClick={() => setOpen((v) => !v)}
|
|
69
|
+
>
|
|
70
|
+
{icon && (
|
|
71
|
+
<span className="velu-nav-select__btn-icon" aria-hidden="true">
|
|
72
|
+
{resolveIcon(icon, { size: '1em' })}
|
|
73
|
+
</span>
|
|
74
|
+
)}
|
|
75
|
+
{valueCode && (
|
|
76
|
+
<span className="velu-nav-select__code">{valueCode}</span>
|
|
77
|
+
)}
|
|
78
|
+
<span className="velu-nav-select__value">{value}</span>
|
|
79
|
+
<ChevronDown
|
|
80
|
+
className="velu-nav-select__chev"
|
|
81
|
+
aria-hidden="true"
|
|
82
|
+
focusable="false"
|
|
83
|
+
/>
|
|
84
|
+
</button>
|
|
85
|
+
<ul className="velu-nav-select__menu" role="menu" aria-hidden={!open}>
|
|
86
|
+
{options.map((o, i) => (
|
|
87
|
+
<li key={o.href ?? i} role="none">
|
|
88
|
+
<Link
|
|
89
|
+
role="menuitem"
|
|
90
|
+
className={`velu-nav-select__item${o.active ? ' velu-nav-select__item--active' : ''}`}
|
|
91
|
+
href={o.href}
|
|
92
|
+
tabIndex={open ? 0 : -1}
|
|
93
|
+
onClick={() => setOpen(false)}
|
|
94
|
+
>
|
|
95
|
+
{o.icon && (
|
|
96
|
+
<span className="velu-nav-select__item-icon" aria-hidden="true">
|
|
97
|
+
{resolveIcon(o.icon, { size: '1em' })}
|
|
98
|
+
</span>
|
|
99
|
+
)}
|
|
100
|
+
{o.code && <span className="velu-nav-select__code">{o.code}</span>}
|
|
101
|
+
<span>{o.label}</span>
|
|
102
|
+
</Link>
|
|
103
|
+
</li>
|
|
104
|
+
))}
|
|
105
|
+
</ul>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import React, { useState, useMemo, useId } from 'react';
|
|
2
|
+
import resolveIcon from '../lib/resolveIcon.jsx';
|
|
3
|
+
import Stack from '../primitives/Stack.jsx';
|
|
4
|
+
import Cluster from '../primitives/Cluster.jsx';
|
|
5
|
+
|
|
6
|
+
/* Improvement reasons shown in the "No" follow-up form. */
|
|
7
|
+
const REASONS = [
|
|
8
|
+
'Help me get started faster',
|
|
9
|
+
"Make it easier to find what I'm looking for",
|
|
10
|
+
'Make it easy to understand the product and features',
|
|
11
|
+
'Update this documentation',
|
|
12
|
+
'Something else',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
/* HeartBurst — a one-shot celebratory burst of hearts. Renders a fan of
|
|
16
|
+
small hearts that pop up-and-out from their anchor point, tilt, and
|
|
17
|
+
fade. Mounted only after a click (never during SSR), so the per-heart
|
|
18
|
+
Math.random() can't cause a hydration mismatch. Re-key it to replay. */
|
|
19
|
+
const HEART_COUNT = 14;
|
|
20
|
+
const HEART_SPREAD = 3.4; // em — horizontal half-width of the fan
|
|
21
|
+
const HEART_PATH =
|
|
22
|
+
'M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z';
|
|
23
|
+
|
|
24
|
+
function HeartBurst() {
|
|
25
|
+
const hearts = useMemo(
|
|
26
|
+
() =>
|
|
27
|
+
Array.from({ length: HEART_COUNT }, () => ({
|
|
28
|
+
tx: `${((Math.random() * 2 - 1) * HEART_SPREAD).toFixed(2)}em`,
|
|
29
|
+
ty: `${(-(0.4 + Math.random() * 0.9) * HEART_SPREAD).toFixed(2)}em`,
|
|
30
|
+
rot: `${Math.round(Math.random() * 120 - 60)}deg`, // gentle tilt
|
|
31
|
+
delay: `${(Math.random() * 0.08).toFixed(3)}s`,
|
|
32
|
+
shade: Math.floor(Math.random() * 4),
|
|
33
|
+
})),
|
|
34
|
+
[],
|
|
35
|
+
);
|
|
36
|
+
return (
|
|
37
|
+
<span className="velu-feedback__hearts" aria-hidden="true">
|
|
38
|
+
{hearts.map((h, i) => (
|
|
39
|
+
<svg
|
|
40
|
+
key={i}
|
|
41
|
+
className={`velu-feedback__heart velu-feedback__heart--${h.shade}`}
|
|
42
|
+
viewBox="0 0 24 24"
|
|
43
|
+
style={{
|
|
44
|
+
'--hb-tx': h.tx,
|
|
45
|
+
'--hb-ty': h.ty,
|
|
46
|
+
'--hb-rot': h.rot,
|
|
47
|
+
animationDelay: h.delay,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<path d={HEART_PATH} />
|
|
51
|
+
</svg>
|
|
52
|
+
))}
|
|
53
|
+
</span>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* PageFeedback — the "Was this page helpful?" row at the foot of a docs
|
|
59
|
+
* page. A question label + Yes / No buttons (thumbs-up / thumbs-down).
|
|
60
|
+
*
|
|
61
|
+
* <PageFeedback onVote={(v) => …} /> // v is 'yes' | 'no'
|
|
62
|
+
*
|
|
63
|
+
* The chosen button takes an accent state. Choosing "Yes" fires a
|
|
64
|
+
* small burst of hearts; choosing "No" expands an improvement form
|
|
65
|
+
* (reason radio group + optional detail + Submit / Cancel). Once the
|
|
66
|
+
* form is submitted — or "Yes" is chosen — a thank-you line shows.
|
|
67
|
+
*
|
|
68
|
+
* - `question` the prompt (default "Was this page helpful?")
|
|
69
|
+
* - `onVote(vote)` fired on every Yes/No change
|
|
70
|
+
* - `onSubmit({ vote, reason, detail })` fired when the "No" form's
|
|
71
|
+
* Submit button is pressed
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export default function PageFeedback({
|
|
75
|
+
question = 'Was this page helpful?',
|
|
76
|
+
onVote,
|
|
77
|
+
onSubmit,
|
|
78
|
+
className = '',
|
|
79
|
+
...rest
|
|
80
|
+
}) {
|
|
81
|
+
const [vote, setVote] = useState(null);
|
|
82
|
+
// Increments each time "Yes" is (re-)chosen — keys <HeartBurst> so
|
|
83
|
+
// the burst replays.
|
|
84
|
+
const [burst, setBurst] = useState(0);
|
|
85
|
+
const [reason, setReason] = useState('');
|
|
86
|
+
const [detail, setDetail] = useState('');
|
|
87
|
+
const [submitted, setSubmitted] = useState(false);
|
|
88
|
+
const radioName = useId();
|
|
89
|
+
|
|
90
|
+
function choose(v) {
|
|
91
|
+
if (v === vote) return; // already selected — no-op
|
|
92
|
+
setVote(v);
|
|
93
|
+
setSubmitted(false);
|
|
94
|
+
onVote?.(v);
|
|
95
|
+
if (v === 'yes') setBurst((b) => b + 1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function cancel() {
|
|
99
|
+
setVote(null);
|
|
100
|
+
setReason('');
|
|
101
|
+
setDetail('');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function submit() {
|
|
105
|
+
setSubmitted(true);
|
|
106
|
+
onSubmit?.({ vote: 'no', reason, detail });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const showForm = vote === 'no' && !submitted;
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Stack
|
|
113
|
+
space="var(--s0)"
|
|
114
|
+
className={`velu-feedback ${className}`.trim()}
|
|
115
|
+
{...rest}
|
|
116
|
+
>
|
|
117
|
+
<Cluster space="var(--s0)" align="center" className="velu-feedback__bar">
|
|
118
|
+
<span className="velu-feedback__question">{question}</span>
|
|
119
|
+
|
|
120
|
+
<Cluster space="var(--s-2)" align="center">
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
className={`velu-feedback__btn${
|
|
124
|
+
vote === 'yes' ? ' velu-feedback__btn--chosen' : ''
|
|
125
|
+
}`}
|
|
126
|
+
onClick={() => choose('yes')}
|
|
127
|
+
aria-pressed={vote === 'yes'}
|
|
128
|
+
>
|
|
129
|
+
<span>Yes</span>
|
|
130
|
+
{resolveIcon('thumbs-up', { size: '1em' })}
|
|
131
|
+
{burst > 0 && <HeartBurst key={burst} />}
|
|
132
|
+
</button>
|
|
133
|
+
<button
|
|
134
|
+
type="button"
|
|
135
|
+
className={`velu-feedback__btn${
|
|
136
|
+
vote === 'no' ? ' velu-feedback__btn--chosen' : ''
|
|
137
|
+
}`}
|
|
138
|
+
onClick={() => choose('no')}
|
|
139
|
+
aria-pressed={vote === 'no'}
|
|
140
|
+
>
|
|
141
|
+
<span>No</span>
|
|
142
|
+
{resolveIcon('thumbs-down', { size: '1em' })}
|
|
143
|
+
</button>
|
|
144
|
+
</Cluster>
|
|
145
|
+
|
|
146
|
+
{vote === 'yes' && (
|
|
147
|
+
<span className="velu-feedback__thanks" role="status">
|
|
148
|
+
Thanks for your feedback
|
|
149
|
+
</span>
|
|
150
|
+
)}
|
|
151
|
+
</Cluster>
|
|
152
|
+
|
|
153
|
+
{showForm && (
|
|
154
|
+
<Stack space="var(--s1)" className="velu-feedback__form">
|
|
155
|
+
<h3 className="velu-feedback__form-title">
|
|
156
|
+
How can we improve our product?
|
|
157
|
+
</h3>
|
|
158
|
+
|
|
159
|
+
<Stack as="div" space="var(--s-2)">
|
|
160
|
+
{REASONS.map((r) => (
|
|
161
|
+
<label key={r} className="velu-feedback__radio">
|
|
162
|
+
<input
|
|
163
|
+
type="radio"
|
|
164
|
+
name={radioName}
|
|
165
|
+
value={r}
|
|
166
|
+
checked={reason === r}
|
|
167
|
+
onChange={() => setReason(r)}
|
|
168
|
+
/>
|
|
169
|
+
<span
|
|
170
|
+
className="velu-feedback__radio-mark"
|
|
171
|
+
aria-hidden="true"
|
|
172
|
+
/>
|
|
173
|
+
<span className="velu-feedback__radio-label">{r}</span>
|
|
174
|
+
</label>
|
|
175
|
+
))}
|
|
176
|
+
</Stack>
|
|
177
|
+
|
|
178
|
+
<textarea
|
|
179
|
+
className="velu-feedback__detail"
|
|
180
|
+
placeholder="(optional) Could you share more about your experience?"
|
|
181
|
+
value={detail}
|
|
182
|
+
onChange={(e) => setDetail(e.target.value)}
|
|
183
|
+
rows={3}
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<Cluster space="var(--s-1)">
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
className="velu-feedback__action velu-feedback__action--cancel"
|
|
190
|
+
onClick={cancel}
|
|
191
|
+
>
|
|
192
|
+
Cancel
|
|
193
|
+
</button>
|
|
194
|
+
<button
|
|
195
|
+
type="button"
|
|
196
|
+
className="velu-feedback__action velu-feedback__action--submit"
|
|
197
|
+
onClick={submit}
|
|
198
|
+
>
|
|
199
|
+
Submit Feedback
|
|
200
|
+
</button>
|
|
201
|
+
</Cluster>
|
|
202
|
+
</Stack>
|
|
203
|
+
)}
|
|
204
|
+
|
|
205
|
+
{submitted && (
|
|
206
|
+
<Stack
|
|
207
|
+
space="var(--s-5)"
|
|
208
|
+
className="velu-feedback__sent"
|
|
209
|
+
role="status"
|
|
210
|
+
>
|
|
211
|
+
<span className="velu-feedback__sent-title">Feedback sent</span>
|
|
212
|
+
<span className="velu-feedback__sent-note">
|
|
213
|
+
Thanks for feedback
|
|
214
|
+
</span>
|
|
215
|
+
</Stack>
|
|
216
|
+
)}
|
|
217
|
+
</Stack>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Stack from '../primitives/Stack.jsx';
|
|
3
|
+
import Cluster from '../primitives/Cluster.jsx';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PageFooter — the docs site's footer.
|
|
7
|
+
*
|
|
8
|
+
* <PageFooter
|
|
9
|
+
* linkComponent={RouterLink}
|
|
10
|
+
* columns={[
|
|
11
|
+
* { title: 'Resources', items: [
|
|
12
|
+
* { label: 'Showcase', href: '/showcase' },
|
|
13
|
+
* { label: 'Enterprise', href: '/enterprise' },
|
|
14
|
+
* { label: 'Status', href: '/status' },
|
|
15
|
+
* ]},
|
|
16
|
+
* { title: 'Company', items: […] },
|
|
17
|
+
* { title: 'Policies', items: […] },
|
|
18
|
+
* ]}
|
|
19
|
+
* socials={[
|
|
20
|
+
* { kind: 'github', href: 'https://github.com/…' },
|
|
21
|
+
* { kind: 'x', href: 'https://x.com/…' },
|
|
22
|
+
* { kind: 'youtube', href: 'https://youtube.com/…' },
|
|
23
|
+
* { kind: 'linkedin', href: 'https://linkedin.com/…' },
|
|
24
|
+
* ]}
|
|
25
|
+
* />
|
|
26
|
+
*
|
|
27
|
+
* Layout: a Switcher row of [brand | columns…] that flips to a vertical
|
|
28
|
+
* stack on narrow widths, with a centered social-icon row below. The
|
|
29
|
+
* number of link columns is whatever you pass — fully data-driven.
|
|
30
|
+
*
|
|
31
|
+
* @typedef {Object} FooterLink
|
|
32
|
+
* @property {string} label
|
|
33
|
+
* @property {string} [href]
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} FooterColumn
|
|
36
|
+
* @property {string} title
|
|
37
|
+
* @property {FooterLink[]} items
|
|
38
|
+
*
|
|
39
|
+
* @typedef {Object} FooterSocial
|
|
40
|
+
* @property {'github'|'x'|'youtube'|'linkedin'} kind
|
|
41
|
+
* @property {string} href
|
|
42
|
+
*
|
|
43
|
+
* @param {{ columns?: FooterColumn[], socials?: FooterSocial[],
|
|
44
|
+
* brand?: { label?: string, href?: string },
|
|
45
|
+
* linkComponent?: React.ElementType, className?: string }} props
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/* ── Brand mark — the Velu double-hook logo. Color: currentColor for
|
|
49
|
+
the surrounding wordmark; the mark itself uses --accent-color via
|
|
50
|
+
the wrapping span. ───────────────────────────────────────────────── */
|
|
51
|
+
function VeluMark() {
|
|
52
|
+
return (
|
|
53
|
+
<svg
|
|
54
|
+
className="velu-footer__mark"
|
|
55
|
+
viewBox="0 0 32 24"
|
|
56
|
+
fill="currentColor"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
>
|
|
59
|
+
<path
|
|
60
|
+
fillRule="evenodd"
|
|
61
|
+
clipRule="evenodd"
|
|
62
|
+
d="M29.6564 14.1534C29.5739 14.5616 29.3507 14.9288 29.0248 15.1926C28.699 15.4565 28.2907 15.6007 27.8694 15.6006H21.3702C20.5341 15.6006 19.8051 16.1627 19.6031 16.9638L18.1671 22.6368C18.0685 23.0263 17.8409 23.372 17.5205 23.619C17.2002 23.866 16.8054 24.0001 16.399 24H10.4378C10.1609 24.0001 9.88759 23.9378 9.63868 23.8179C9.38976 23.6979 9.1718 23.5235 9.00135 23.3079C8.8309 23.0923 8.71245 22.8412 8.65499 22.5736C8.59754 22.306 8.6026 22.029 8.66978 21.7636L10.1888 15.7636C10.2874 15.3743 10.5148 15.0287 10.835 14.7817C11.1551 14.5347 11.5496 14.4005 11.9559 14.4004H18.3931C19.2621 14.4004 20.0101 13.7949 20.1801 12.9532L22.3882 2.04774C22.4705 1.63945 22.6936 1.27198 23.0195 1.00793C23.3453 0.74388 23.7538 0.599578 24.1752 0.599605H30.1774C30.4471 0.599529 30.7134 0.658587 30.9572 0.772515C31.201 0.886444 31.4161 1.0524 31.5871 1.25842C31.758 1.46443 31.8806 1.70537 31.9458 1.96383C32.0111 2.2223 32.0175 2.49185 31.9645 2.75305L29.6564 14.1534ZM9.61081 13.5538C9.52825 13.962 9.30507 14.3292 8.97924 14.593C8.65341 14.857 8.24508 15.0011 7.82375 15.001H1.82257C1.55289 15.0011 1.28656 14.942 1.04279 14.8281C0.79902 14.7141 0.583892 14.5482 0.412928 14.3422C0.241965 14.1362 0.11943 13.8952 0.0541639 13.6368C-0.0111017 13.3783 -0.0174699 13.1087 0.0355186 12.8475L2.34359 1.44715C2.42614 1.03904 2.64933 0.671798 2.97516 0.407944C3.30099 0.144089 3.70932 -7.24082e-05 4.13064 7.25899e-08H10.1318C10.4015 -7.55792e-05 10.6678 0.0589818 10.9116 0.172911C11.1554 0.286839 11.3705 0.453799 11.5415 0.659813C11.7124 0.864828 11.835 1.10576 11.9002 1.36423C11.9655 1.62269 11.9719 1.89225 11.9189 2.15344L9.61081 13.553L9.61081 13.5538Z"
|
|
63
|
+
/>
|
|
64
|
+
</svg>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ── Social glyphs — inline SVGs with fill: currentColor so they
|
|
69
|
+
inherit color (themed) and flip with light/dark. ─────────────────── */
|
|
70
|
+
function GithubIcon() {
|
|
71
|
+
return (
|
|
72
|
+
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
|
|
73
|
+
<path
|
|
74
|
+
fillRule="evenodd"
|
|
75
|
+
clipRule="evenodd"
|
|
76
|
+
d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"
|
|
77
|
+
/>
|
|
78
|
+
</svg>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function XIcon() {
|
|
82
|
+
return (
|
|
83
|
+
<svg viewBox="0 0 1200 1227" fill="currentColor" aria-hidden="true">
|
|
84
|
+
<path d="M714.163 519.284 1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284h.026ZM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854v-.026Z" />
|
|
85
|
+
</svg>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function YoutubeIcon() {
|
|
89
|
+
return (
|
|
90
|
+
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
91
|
+
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
|
|
92
|
+
</svg>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function LinkedinIcon() {
|
|
96
|
+
return (
|
|
97
|
+
<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true">
|
|
98
|
+
<path d="M218.123 218.127h-37.931v-59.403c0-14.165-.253-32.4-19.728-32.4-19.756 0-22.779 15.434-22.779 31.369v60.43h-37.93V95.967h36.413v16.694h.51a39.907 39.907 0 0 1 35.928-19.733c38.445 0 45.533 25.288 45.533 58.186l-.016 67.013ZM56.955 79.27c-12.157.002-22.014-9.852-22.016-22.009-.002-12.157 9.851-22.014 22.008-22.016 12.157-.003 22.014 9.851 22.016 22.008A22.013 22.013 0 0 1 56.955 79.27m18.966 138.858H37.95V95.967h37.97v122.16ZM237.033.018H18.89C8.58-.098.125 8.161-.001 18.471v219.053c.122 10.315 8.576 18.582 18.89 18.474h218.144c10.336.128 18.823-8.139 18.966-18.474V18.454c-.147-10.33-8.635-18.588-18.966-18.453" />
|
|
99
|
+
</svg>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const SOCIAL_ICONS = {
|
|
104
|
+
github: GithubIcon,
|
|
105
|
+
x: XIcon,
|
|
106
|
+
youtube: YoutubeIcon,
|
|
107
|
+
linkedin: LinkedinIcon,
|
|
108
|
+
};
|
|
109
|
+
const SOCIAL_LABELS = {
|
|
110
|
+
github: 'GitHub',
|
|
111
|
+
x: 'X',
|
|
112
|
+
youtube: 'YouTube',
|
|
113
|
+
linkedin: 'LinkedIn',
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default function PageFooter({
|
|
117
|
+
brand,
|
|
118
|
+
columns = [],
|
|
119
|
+
socials = [],
|
|
120
|
+
linkComponent = 'a',
|
|
121
|
+
className = '',
|
|
122
|
+
...rest
|
|
123
|
+
}) {
|
|
124
|
+
const Link = linkComponent;
|
|
125
|
+
const brandLabel = brand?.label ?? 'Velu';
|
|
126
|
+
const brandHref = brand?.href;
|
|
127
|
+
|
|
128
|
+
const brandNode = (
|
|
129
|
+
<Cluster space="var(--s-3)" align="center" className="velu-footer__brand">
|
|
130
|
+
<VeluMark />
|
|
131
|
+
<span className="velu-footer__wordmark">{brandLabel}</span>
|
|
132
|
+
</Cluster>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<Stack
|
|
137
|
+
as="footer"
|
|
138
|
+
space="var(--s2)"
|
|
139
|
+
className={`velu-footer ${className}`.trim()}
|
|
140
|
+
{...rest}
|
|
141
|
+
>
|
|
142
|
+
{/* Container groups the brand row and the columns row. */}
|
|
143
|
+
<Stack space="var(--s2)" className="velu-footer__container">
|
|
144
|
+
{/* Row 1: brand */}
|
|
145
|
+
<div className="velu-footer__row velu-footer__row--brand">
|
|
146
|
+
{brandHref ? (
|
|
147
|
+
<Link href={brandHref} className="velu-footer__brand-link">
|
|
148
|
+
{brandNode}
|
|
149
|
+
</Link>
|
|
150
|
+
) : (
|
|
151
|
+
brandNode
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{/* Row 2: link columns — each column hugs its content. Plain
|
|
156
|
+
flex row (not Cluster) so column-gap (large, between
|
|
157
|
+
columns) and row-gap (small, when columns wrap onto a new
|
|
158
|
+
line) can be set independently. CSS owns the gaps. */}
|
|
159
|
+
<div className="velu-footer__row velu-footer__row--columns">
|
|
160
|
+
{columns.map((col, i) => (
|
|
161
|
+
<Stack
|
|
162
|
+
key={i}
|
|
163
|
+
space="var(--s-2)"
|
|
164
|
+
className="velu-footer__column"
|
|
165
|
+
>
|
|
166
|
+
<span className="velu-footer__column-title">{col.title}</span>
|
|
167
|
+
<Stack space="var(--s-5)" as="ul" className="velu-footer__list">
|
|
168
|
+
{(col.items ?? []).map((it, j) => (
|
|
169
|
+
<li key={j}>
|
|
170
|
+
<Link
|
|
171
|
+
href={it.href ?? '#'}
|
|
172
|
+
className="velu-footer__link"
|
|
173
|
+
>
|
|
174
|
+
{it.label}
|
|
175
|
+
</Link>
|
|
176
|
+
</li>
|
|
177
|
+
))}
|
|
178
|
+
</Stack>
|
|
179
|
+
</Stack>
|
|
180
|
+
))}
|
|
181
|
+
</div>
|
|
182
|
+
</Stack>
|
|
183
|
+
|
|
184
|
+
{/* Socials sit OUTSIDE the container, at the bottom of the footer. */}
|
|
185
|
+
{socials.length > 0 && (
|
|
186
|
+
<Cluster
|
|
187
|
+
space="var(--s-2)"
|
|
188
|
+
justify="center"
|
|
189
|
+
align="center"
|
|
190
|
+
className="velu-footer__socials"
|
|
191
|
+
>
|
|
192
|
+
{socials.map((s, i) => {
|
|
193
|
+
const Icon = SOCIAL_ICONS[s.kind];
|
|
194
|
+
if (!Icon) return null;
|
|
195
|
+
return (
|
|
196
|
+
<a
|
|
197
|
+
key={i}
|
|
198
|
+
href={s.href}
|
|
199
|
+
target="_blank"
|
|
200
|
+
rel="noreferrer"
|
|
201
|
+
aria-label={SOCIAL_LABELS[s.kind] ?? s.kind}
|
|
202
|
+
className="velu-footer__social"
|
|
203
|
+
data-kind={s.kind}
|
|
204
|
+
>
|
|
205
|
+
<Icon />
|
|
206
|
+
</a>
|
|
207
|
+
);
|
|
208
|
+
})}
|
|
209
|
+
</Cluster>
|
|
210
|
+
)}
|
|
211
|
+
</Stack>
|
|
212
|
+
);
|
|
213
|
+
}
|