@igamingcareer/igaming-components 1.0.88 → 1.0.90

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.
Files changed (4) hide show
  1. package/Readme.md +132 -0
  2. package/dist/index.js +236 -236
  3. package/dist/index.mjs +3324 -3281
  4. package/package.json +1 -1
package/Readme.md CHANGED
@@ -248,6 +248,138 @@ export function CompanyAdminExample({ company }: { company: Company }) {
248
248
  - **Save button disabled:** verify `isSaving` is `false` and `canEdit` is `true`.
249
249
  - **Updates not persisting:** confirm your parent handler merges the payload back into company state.
250
250
 
251
+ ## Dashboard tab routing events
252
+
253
+ The Dashboard component can emit a routing-friendly event whenever a tab is selected. Use it to keep your app router in sync (for example, pushing routes in Next.js). You can also pass an `activeTab` prop to control the active tab from outside, along with a `tabPaths` map so your app remains the source of truth for URL formats.
254
+
255
+ ```tsx
256
+ import { useState } from "react";
257
+ import {
258
+ Dashboard,
259
+ type DashboardTab,
260
+ type DashboardTabChangeEvent,
261
+ } from "@igamingcareer/igaming-components";
262
+
263
+ export function DashboardWithRouter({ data }: { data: DashboardData }) {
264
+ const [activeTab, setActiveTab] = useState<DashboardTab>("overview");
265
+
266
+ const handleTabChange = (event: DashboardTabChangeEvent) => {
267
+ setActiveTab(event.tab);
268
+ // Example: Next.js router
269
+ // router.push(event.path ?? "/dashboard");
270
+ };
271
+
272
+ return (
273
+ <Dashboard
274
+ user={data.user}
275
+ profileData={data.profile}
276
+ alerts={data.alerts}
277
+ snapshot={data.snapshot}
278
+ feedItems={data.feedItems}
279
+ onUpdateProfile={data.onUpdateProfile}
280
+ activeTab={activeTab}
281
+ tabPaths={{
282
+ overview: "/dashboard",
283
+ profile: "/dashboard/profile",
284
+ jobs: "/dashboard/jobs",
285
+ courses: "/dashboard/courses",
286
+ news: "/dashboard/news",
287
+ settings: "/dashboard/settings",
288
+ }}
289
+ onTabChange={handleTabChange}
290
+ />
291
+ );
292
+ }
293
+ ```
294
+
295
+ ## Company detail tab routing events
296
+
297
+ The CompanyDetail component can emit a routing-friendly event whenever a tab is selected, so your Next.js app remains the source of truth for URLs. Provide `activeTab`, `tabPaths`, and `onTabChange` to keep routing and UI in sync.
298
+
299
+ ```tsx
300
+ import { useState } from "react";
301
+ import {
302
+ CompanyDetail,
303
+ type CompanyDetailTab,
304
+ type CompanyDetailTabChangeEvent,
305
+ } from "@igamingcareer/igaming-components";
306
+
307
+ export function CompanyDetailWithRouter({ data }: { data: CompanyDetailData }) {
308
+ const [activeTab, setActiveTab] = useState<CompanyDetailTab>("overview");
309
+
310
+ const handleTabChange = (event: CompanyDetailTabChangeEvent) => {
311
+ setActiveTab(event.tab);
312
+ // Example: Next.js router
313
+ // router.push(event.path ?? `/companies/${data.company.slug}`);
314
+ };
315
+
316
+ return (
317
+ <CompanyDetail
318
+ company={data.company}
319
+ jobs={data.jobs}
320
+ news={data.news}
321
+ events={data.events}
322
+ activeTab={activeTab}
323
+ tabPaths={{
324
+ overview: `/companies/${data.company.slug}`,
325
+ products: `/companies/${data.company.slug}/products`,
326
+ trust: `/companies/${data.company.slug}/trust`,
327
+ people: `/companies/${data.company.slug}/people`,
328
+ jobs: `/companies/${data.company.slug}/jobs`,
329
+ news: `/companies/${data.company.slug}/news`,
330
+ events: `/companies/${data.company.slug}/events`,
331
+ insights: `/companies/${data.company.slug}/insights`,
332
+ }}
333
+ onTabChange={handleTabChange}
334
+ />
335
+ );
336
+ }
337
+ ```
338
+
339
+ ## Dashboard tab routing events
340
+
341
+ The Dashboard component can emit a routing-friendly event whenever a tab is selected. Use it to keep your app router in sync (for example, pushing routes in Next.js). You can also pass an `activeTab` prop to control the active tab from outside, along with a `tabPaths` map so your app remains the source of truth for URL formats.
342
+
343
+ ```tsx
344
+ import { useState } from "react";
345
+ import {
346
+ Dashboard,
347
+ type DashboardTab,
348
+ type DashboardTabChangeEvent,
349
+ } from "@igamingcareer/igaming-components";
350
+
351
+ export function DashboardWithRouter({ data }: { data: DashboardData }) {
352
+ const [activeTab, setActiveTab] = useState<DashboardTab>("overview");
353
+
354
+ const handleTabChange = (event: DashboardTabChangeEvent) => {
355
+ setActiveTab(event.tab);
356
+ // Example: Next.js router
357
+ // router.push(event.path ?? "/dashboard");
358
+ };
359
+
360
+ return (
361
+ <Dashboard
362
+ user={data.user}
363
+ profileData={data.profile}
364
+ alerts={data.alerts}
365
+ snapshot={data.snapshot}
366
+ feedItems={data.feedItems}
367
+ onUpdateProfile={data.onUpdateProfile}
368
+ activeTab={activeTab}
369
+ tabPaths={{
370
+ overview: "/dashboard",
371
+ profile: "/dashboard/profile",
372
+ jobs: "/dashboard/jobs",
373
+ courses: "/dashboard/courses",
374
+ news: "/dashboard/news",
375
+ settings: "/dashboard/settings",
376
+ }}
377
+ onTabChange={handleTabChange}
378
+ />
379
+ );
380
+ }
381
+ ```
382
+
251
383
  ## Save company callbacks (CompanyCard + CompanyDetail)
252
384
 
253
385
  The company components also emit save events so host apps can manage bookmarking without API logic inside the library. Use the save props to track state and respond to user interactions.