@quikturn/logos-react 1.0.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/README.md ADDED
@@ -0,0 +1,323 @@
1
+ # @quikturn/logos-react
2
+
3
+ > React components for the Quikturn Logos API -- drop-in logo display, infinite carousel, and responsive grid.
4
+
5
+ ## Features
6
+
7
+ - **`<QuikturnLogo>`** -- single logo image with lazy loading, optional link wrapper
8
+ - **`<QuikturnLogoCarousel>`** -- infinite scrolling logo ticker (horizontal or vertical)
9
+ - **`<QuikturnLogoGrid>`** -- responsive CSS grid of logos
10
+ - **`<QuikturnProvider>`** -- context provider for token and base URL propagation
11
+ - **`useLogoUrl()`** -- hook that returns a memoized Quikturn logo URL
12
+ - **Zero CSS dependencies** -- inline styles only, no Tailwind or CSS-in-JS required
13
+ - **Tree-shakeable** -- ESM and CJS dual builds; import only what you use
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ # pnpm (recommended)
19
+ pnpm add @quikturn/logos-react @quikturn/logos react react-dom
20
+
21
+ # npm
22
+ npm install @quikturn/logos-react @quikturn/logos react react-dom
23
+ ```
24
+
25
+ **Peer dependencies:** `react >= 18`, `react-dom >= 18`, `@quikturn/logos >= 0.1.0`
26
+
27
+ ## Quick Start
28
+
29
+ ```tsx
30
+ import { QuikturnProvider, QuikturnLogo, QuikturnLogoCarousel } from "@quikturn/logos-react";
31
+
32
+ function App() {
33
+ return (
34
+ <QuikturnProvider token="qt_your_publishable_key">
35
+ {/* Single logo */}
36
+ <QuikturnLogo domain="github.com" size={64} />
37
+
38
+ {/* Infinite scrolling carousel */}
39
+ <QuikturnLogoCarousel
40
+ domains={["github.com", "stripe.com", "vercel.com", "figma.com"]}
41
+ speed={120}
42
+ logoHeight={28}
43
+ gap={48}
44
+ fadeOut
45
+ />
46
+ </QuikturnProvider>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ## API Reference
52
+
53
+ ### `<QuikturnProvider>`
54
+
55
+ Provides `token` and `baseUrl` to all nested components via React Context. Individual components can override these values with their own props.
56
+
57
+ ```tsx
58
+ <QuikturnProvider token="qt_abc123" baseUrl="https://custom.api">
59
+ {children}
60
+ </QuikturnProvider>
61
+ ```
62
+
63
+ | Prop | Type | Required | Description |
64
+ |------|------|----------|-------------|
65
+ | `token` | `string` | yes | Publishable API key (`qt_`/`pk_` prefix) |
66
+ | `baseUrl` | `string` | no | Override the Quikturn API base URL |
67
+ | `children` | `ReactNode` | yes | Child components |
68
+
69
+ ---
70
+
71
+ ### `<QuikturnLogo>`
72
+
73
+ Renders a single logo `<img>`. Optionally wraps in an `<a>` tag when `href` is provided.
74
+
75
+ ```tsx
76
+ <QuikturnLogo
77
+ domain="stripe.com"
78
+ size={128}
79
+ format="webp"
80
+ greyscale
81
+ theme="dark"
82
+ alt="Stripe"
83
+ href="https://stripe.com"
84
+ loading="lazy"
85
+ className="my-logo"
86
+ style={{ borderRadius: 8 }}
87
+ />
88
+ ```
89
+
90
+ | Prop | Type | Default | Description |
91
+ |------|------|---------|-------------|
92
+ | `domain` | `string` | **required** | Domain to fetch logo for |
93
+ | `token` | `string` | from context | Publishable API key |
94
+ | `baseUrl` | `string` | from context | API base URL override |
95
+ | `size` | `number` | `128` | Logo width in pixels |
96
+ | `format` | `string` | `"image/png"` | `"png"`, `"jpeg"`, `"webp"`, `"avif"`, or MIME type |
97
+ | `greyscale` | `boolean` | `false` | Greyscale transformation |
98
+ | `theme` | `"light" \| "dark"` | -- | Background-optimized rendering |
99
+ | `alt` | `string` | `"<domain> logo"` | Image alt text |
100
+ | `href` | `string` | -- | Wraps the image in a link |
101
+ | `loading` | `"lazy" \| "eager"` | `"lazy"` | Native image loading strategy |
102
+ | `className` | `string` | -- | CSS class on wrapper element |
103
+ | `style` | `CSSProperties` | -- | Inline styles on wrapper element |
104
+ | `onLoad` | `ReactEventHandler` | -- | Fires when the image loads |
105
+ | `onError` | `ReactEventHandler` | -- | Fires on image load error |
106
+
107
+ ---
108
+
109
+ ### `<QuikturnLogoCarousel>`
110
+
111
+ Infinite scrolling logo ticker powered by `requestAnimationFrame`. Supports horizontal (left/right) and vertical (up/down) scrolling, hover-based speed changes, fade overlays, and per-logo customization.
112
+
113
+ ```tsx
114
+ <QuikturnLogoCarousel
115
+ domains={["github.com", "stripe.com", "vercel.com", "figma.com"]}
116
+ speed={120}
117
+ direction="left"
118
+ logoHeight={28}
119
+ gap={48}
120
+ fadeOut
121
+ fadeOutColor="#f5f5f5"
122
+ pauseOnHover
123
+ scaleOnHover
124
+ width="100%"
125
+ />
126
+ ```
127
+
128
+ #### Using `logos` for per-logo configuration
129
+
130
+ ```tsx
131
+ <QuikturnLogoCarousel
132
+ logos={[
133
+ { domain: "github.com", href: "https://github.com", alt: "GitHub" },
134
+ { domain: "stripe.com", size: 256, greyscale: true },
135
+ { domain: "vercel.com", theme: "dark" },
136
+ ]}
137
+ />
138
+ ```
139
+
140
+ | Prop | Type | Default | Description |
141
+ |------|------|---------|-------------|
142
+ | `domains` | `string[]` | -- | Simple list of domains (use this or `logos`) |
143
+ | `logos` | `LogoConfig[]` | -- | Per-logo configuration objects (use this or `domains`) |
144
+ | `token` | `string` | from context | Publishable API key |
145
+ | `baseUrl` | `string` | from context | API base URL override |
146
+ | `speed` | `number` | `120` | Scroll speed in pixels per second |
147
+ | `direction` | `"left" \| "right" \| "up" \| "down"` | `"left"` | Scroll direction |
148
+ | `pauseOnHover` | `boolean` | `false` | Pause scrolling on mouse hover |
149
+ | `hoverSpeed` | `number` | -- | Custom speed during hover (`0` = pause, overrides `pauseOnHover`) |
150
+ | `logoHeight` | `number` | `28` | Height of each logo image in pixels |
151
+ | `gap` | `number` | `32` | Gap between logos in pixels |
152
+ | `width` | `number \| string` | `"100%"` | Container width (`600`, `"80%"`, etc.) |
153
+ | `fadeOut` | `boolean` | `false` | Show gradient fade overlays at edges |
154
+ | `fadeOutColor` | `string` | `"#ffffff"` | Fade overlay color (match your background) |
155
+ | `scaleOnHover` | `boolean` | `false` | Scale logos on individual hover |
156
+ | `logoSize` | `number` | `128` | Default image fetch width for all logos |
157
+ | `logoFormat` | `string` | -- | Default image format for all logos |
158
+ | `logoGreyscale` | `boolean` | -- | Default greyscale setting for all logos |
159
+ | `logoTheme` | `"light" \| "dark"` | -- | Default theme for all logos |
160
+ | `renderItem` | `(logo, index) => ReactNode` | -- | Custom renderer per logo |
161
+ | `className` | `string` | -- | CSS class on root container |
162
+ | `style` | `CSSProperties` | -- | Inline styles on root container |
163
+ | `ariaLabel` | `string` | `"Company logos"` | Accessible label for the region |
164
+
165
+ #### `LogoConfig`
166
+
167
+ Used in the `logos` array prop for per-logo customization:
168
+
169
+ ```ts
170
+ interface LogoConfig {
171
+ domain: string; // Required
172
+ href?: string; // Wrap in link
173
+ alt?: string; // Alt text override
174
+ size?: number; // Per-logo image width
175
+ format?: string; // Per-logo format
176
+ greyscale?: boolean; // Per-logo greyscale
177
+ theme?: "light" | "dark";
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ### `<QuikturnLogoGrid>`
184
+
185
+ Responsive CSS grid of logos. Each logo is centered in its grid cell.
186
+
187
+ ```tsx
188
+ <QuikturnLogoGrid
189
+ domains={["github.com", "stripe.com", "vercel.com", "figma.com"]}
190
+ columns={4}
191
+ gap={24}
192
+ ariaLabel="Our partners"
193
+ />
194
+ ```
195
+
196
+ | Prop | Type | Default | Description |
197
+ |------|------|---------|-------------|
198
+ | `domains` | `string[]` | -- | Simple list of domains (use this or `logos`) |
199
+ | `logos` | `LogoConfig[]` | -- | Per-logo configuration objects |
200
+ | `token` | `string` | from context | Publishable API key |
201
+ | `baseUrl` | `string` | from context | API base URL override |
202
+ | `columns` | `number` | `4` | Number of grid columns |
203
+ | `gap` | `number` | `24` | Grid gap in pixels |
204
+ | `logoSize` | `number` | `128` | Default image fetch width |
205
+ | `logoFormat` | `string` | -- | Default image format |
206
+ | `logoGreyscale` | `boolean` | -- | Default greyscale |
207
+ | `logoTheme` | `"light" \| "dark"` | -- | Default theme |
208
+ | `renderItem` | `(logo, index) => ReactNode` | -- | Custom renderer per logo |
209
+ | `className` | `string` | -- | CSS class on grid container |
210
+ | `style` | `CSSProperties` | -- | Inline styles on grid container |
211
+ | `ariaLabel` | `string` | `"Company logos"` | Accessible label for the region |
212
+
213
+ ---
214
+
215
+ ### `useLogoUrl(domain, options?)`
216
+
217
+ Hook that returns a memoized Quikturn logo URL string. Pulls `token` and `baseUrl` from context unless overridden.
218
+
219
+ ```tsx
220
+ import { useLogoUrl } from "@quikturn/logos-react";
221
+
222
+ function MyComponent() {
223
+ const url = useLogoUrl("github.com", { size: 256, format: "webp" });
224
+ return <img src={url} alt="GitHub" />;
225
+ }
226
+ ```
227
+
228
+ | Parameter | Type | Description |
229
+ |-----------|------|-------------|
230
+ | `domain` | `string` | Domain to build URL for |
231
+ | `options.token` | `string` | Override context token |
232
+ | `options.baseUrl` | `string` | Override context base URL |
233
+ | `options.size` | `number` | Image width in pixels |
234
+ | `options.format` | `string` | Output format |
235
+ | `options.greyscale` | `boolean` | Greyscale transformation |
236
+ | `options.theme` | `"light" \| "dark"` | Theme optimization |
237
+
238
+ **Returns:** `string` -- fully-qualified logo URL
239
+
240
+ ---
241
+
242
+ ## Examples
243
+
244
+ ### Logo Wall (Marketing Page)
245
+
246
+ ```tsx
247
+ const PARTNERS = [
248
+ "github.com", "stripe.com", "vercel.com", "figma.com",
249
+ "linear.app", "notion.so", "slack.com", "discord.com",
250
+ ];
251
+
252
+ function LogoWall() {
253
+ return (
254
+ <QuikturnProvider token="qt_your_key">
255
+ <h2>Trusted by industry leaders</h2>
256
+ <QuikturnLogoCarousel
257
+ domains={PARTNERS}
258
+ speed={80}
259
+ logoHeight={32}
260
+ gap={64}
261
+ fadeOut
262
+ pauseOnHover
263
+ />
264
+ </QuikturnProvider>
265
+ );
266
+ }
267
+ ```
268
+
269
+ ### Partner Grid with Links
270
+
271
+ ```tsx
272
+ function PartnerGrid() {
273
+ return (
274
+ <QuikturnProvider token="qt_your_key">
275
+ <QuikturnLogoGrid
276
+ logos={[
277
+ { domain: "github.com", href: "https://github.com", alt: "GitHub" },
278
+ { domain: "stripe.com", href: "https://stripe.com", alt: "Stripe" },
279
+ { domain: "vercel.com", href: "https://vercel.com", alt: "Vercel" },
280
+ { domain: "figma.com", href: "https://figma.com", alt: "Figma" },
281
+ ]}
282
+ columns={2}
283
+ gap={32}
284
+ />
285
+ </QuikturnProvider>
286
+ );
287
+ }
288
+ ```
289
+
290
+ ### Custom Carousel Item
291
+
292
+ ```tsx
293
+ function CustomCarousel() {
294
+ return (
295
+ <QuikturnLogoCarousel
296
+ domains={["github.com", "stripe.com"]}
297
+ token="qt_your_key"
298
+ renderItem={(logo, index) => (
299
+ <div style={{ padding: 12, background: "#f9f9f9", borderRadius: 8 }}>
300
+ <img src={logo.url} alt={logo.alt} height={32} />
301
+ <span style={{ fontSize: 10, color: "#666" }}>{logo.domain}</span>
302
+ </div>
303
+ )}
304
+ />
305
+ );
306
+ }
307
+ ```
308
+
309
+ ### Vertical Carousel
310
+
311
+ ```tsx
312
+ <QuikturnLogoCarousel
313
+ domains={["github.com", "stripe.com", "vercel.com"]}
314
+ token="qt_your_key"
315
+ direction="up"
316
+ speed={60}
317
+ logoHeight={24}
318
+ />
319
+ ```
320
+
321
+ ## License
322
+
323
+ MIT