@igamingcareer/igaming-components 1.0.89 → 1.0.91
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 +177 -0
- package/dist/index.js +17 -17
- package/dist/index.mjs +836 -815
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -292,6 +292,183 @@ 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
|
+
|
|
340
|
+
## Dashboard tab routing events
|
|
341
|
+
|
|
342
|
+
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.
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
import { useState } from "react";
|
|
346
|
+
import {
|
|
347
|
+
Dashboard,
|
|
348
|
+
type DashboardTab,
|
|
349
|
+
type DashboardTabChangeEvent,
|
|
350
|
+
} from "@igamingcareer/igaming-components";
|
|
351
|
+
|
|
352
|
+
export function DashboardWithRouter({ data }: { data: DashboardData }) {
|
|
353
|
+
const [activeTab, setActiveTab] = useState<DashboardTab>("overview");
|
|
354
|
+
|
|
355
|
+
const handleTabChange = (event: DashboardTabChangeEvent) => {
|
|
356
|
+
setActiveTab(event.tab);
|
|
357
|
+
// Example: Next.js router
|
|
358
|
+
// router.push(event.path ?? "/dashboard");
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<Dashboard
|
|
363
|
+
user={data.user}
|
|
364
|
+
profileData={data.profile}
|
|
365
|
+
alerts={data.alerts}
|
|
366
|
+
snapshot={data.snapshot}
|
|
367
|
+
feedItems={data.feedItems}
|
|
368
|
+
onUpdateProfile={data.onUpdateProfile}
|
|
369
|
+
activeTab={activeTab}
|
|
370
|
+
tabPaths={{
|
|
371
|
+
overview: "/dashboard",
|
|
372
|
+
profile: "/dashboard/profile",
|
|
373
|
+
jobs: "/dashboard/jobs",
|
|
374
|
+
courses: "/dashboard/courses",
|
|
375
|
+
news: "/dashboard/news",
|
|
376
|
+
settings: "/dashboard/settings",
|
|
377
|
+
}}
|
|
378
|
+
onTabChange={handleTabChange}
|
|
379
|
+
/>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Company detail tab routing events
|
|
385
|
+
|
|
386
|
+
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.
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
import { useState } from "react";
|
|
390
|
+
import {
|
|
391
|
+
CompanyDetail,
|
|
392
|
+
type CompanyDetailTab,
|
|
393
|
+
type CompanyDetailTabChangeEvent,
|
|
394
|
+
} from "@igamingcareer/igaming-components";
|
|
395
|
+
|
|
396
|
+
export function CompanyDetailWithRouter({ data }: { data: CompanyDetailData }) {
|
|
397
|
+
const [activeTab, setActiveTab] = useState<CompanyDetailTab>("overview");
|
|
398
|
+
|
|
399
|
+
const handleTabChange = (event: CompanyDetailTabChangeEvent) => {
|
|
400
|
+
setActiveTab(event.tab);
|
|
401
|
+
// Example: Next.js router
|
|
402
|
+
// router.push(event.path ?? `/companies/${data.company.slug}`);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
return (
|
|
406
|
+
<CompanyDetail
|
|
407
|
+
company={data.company}
|
|
408
|
+
jobs={data.jobs}
|
|
409
|
+
news={data.news}
|
|
410
|
+
events={data.events}
|
|
411
|
+
activeTab={activeTab}
|
|
412
|
+
tabPaths={{
|
|
413
|
+
overview: `/companies/${data.company.slug}`,
|
|
414
|
+
products: `/companies/${data.company.slug}/products`,
|
|
415
|
+
trust: `/companies/${data.company.slug}/trust`,
|
|
416
|
+
people: `/companies/${data.company.slug}/people`,
|
|
417
|
+
jobs: `/companies/${data.company.slug}/jobs`,
|
|
418
|
+
news: `/companies/${data.company.slug}/news`,
|
|
419
|
+
events: `/companies/${data.company.slug}/events`,
|
|
420
|
+
insights: `/companies/${data.company.slug}/insights`,
|
|
421
|
+
}}
|
|
422
|
+
onTabChange={handleTabChange}
|
|
423
|
+
/>
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
## Dashboard tab routing events
|
|
429
|
+
|
|
430
|
+
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.
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
import { useState } from "react";
|
|
434
|
+
import {
|
|
435
|
+
Dashboard,
|
|
436
|
+
type DashboardTab,
|
|
437
|
+
type DashboardTabChangeEvent,
|
|
438
|
+
} from "@igamingcareer/igaming-components";
|
|
439
|
+
|
|
440
|
+
export function DashboardWithRouter({ data }: { data: DashboardData }) {
|
|
441
|
+
const [activeTab, setActiveTab] = useState<DashboardTab>("overview");
|
|
442
|
+
|
|
443
|
+
const handleTabChange = (event: DashboardTabChangeEvent) => {
|
|
444
|
+
setActiveTab(event.tab);
|
|
445
|
+
// Example: Next.js router
|
|
446
|
+
// router.push(event.path ?? "/dashboard");
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
return (
|
|
450
|
+
<Dashboard
|
|
451
|
+
user={data.user}
|
|
452
|
+
profileData={data.profile}
|
|
453
|
+
alerts={data.alerts}
|
|
454
|
+
snapshot={data.snapshot}
|
|
455
|
+
feedItems={data.feedItems}
|
|
456
|
+
onUpdateProfile={data.onUpdateProfile}
|
|
457
|
+
activeTab={activeTab}
|
|
458
|
+
tabPaths={{
|
|
459
|
+
overview: "/dashboard",
|
|
460
|
+
profile: "/dashboard/profile",
|
|
461
|
+
jobs: "/dashboard/jobs",
|
|
462
|
+
courses: "/dashboard/courses",
|
|
463
|
+
news: "/dashboard/news",
|
|
464
|
+
settings: "/dashboard/settings",
|
|
465
|
+
}}
|
|
466
|
+
onTabChange={handleTabChange}
|
|
467
|
+
/>
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
295
472
|
## Save company callbacks (CompanyCard + CompanyDetail)
|
|
296
473
|
|
|
297
474
|
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.
|