@igamingcareer/igaming-components 1.0.88 → 1.0.89

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 +44 -0
  2. package/dist/index.js +236 -236
  3. package/dist/index.mjs +2748 -2726
  4. package/package.json +1 -1
package/Readme.md CHANGED
@@ -248,6 +248,50 @@ 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
+
251
295
  ## Save company callbacks (CompanyCard + CompanyDetail)
252
296
 
253
297
  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.