@igamingcareer/igaming-components 1.0.89 → 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.
package/Readme.md CHANGED
@@ -292,6 +292,94 @@ export function DashboardWithRouter({ data }: { data: DashboardData }) {
292
292
  }
293
293
  ```
294
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
+
295
383
  ## Save company callbacks (CompanyCard + CompanyDetail)
296
384
 
297
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.