@igamingcareer/igaming-components 1.0.99 → 1.0.100
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 +88 -0
- package/dist/index.js +1559 -1559
- package/dist/index.mjs +13771 -13402
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -69,6 +69,94 @@ export function Example() {
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
## Notifications (global notification system)
|
|
73
|
+
|
|
74
|
+
The notification system provides a provider, hook, and global helpers to trigger messages from anywhere in your app.
|
|
75
|
+
|
|
76
|
+
### Setup
|
|
77
|
+
|
|
78
|
+
Wrap your application with the provider once (typically in your app/layout/root component):
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import {
|
|
82
|
+
NotificationProvider,
|
|
83
|
+
} from "@igamingcareer/igaming-components";
|
|
84
|
+
import "@igamingcareer/igaming-components/styles/globals.css";
|
|
85
|
+
|
|
86
|
+
export function AppRoot({ children }: { children: React.ReactNode }) {
|
|
87
|
+
return (
|
|
88
|
+
<NotificationProvider placement="top-right">
|
|
89
|
+
{children}
|
|
90
|
+
</NotificationProvider>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Trigger notifications with the hook
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { useNotification } from "@igamingcareer/igaming-components";
|
|
99
|
+
|
|
100
|
+
export function ProfileSaveButton() {
|
|
101
|
+
const { notify } = useNotification();
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<button
|
|
105
|
+
onClick={() =>
|
|
106
|
+
notify({
|
|
107
|
+
type: "success",
|
|
108
|
+
title: "Profile updated",
|
|
109
|
+
message: "Your changes were saved successfully.",
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
Save
|
|
114
|
+
</button>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Trigger notifications globally
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { notify } from "@igamingcareer/igaming-components";
|
|
123
|
+
|
|
124
|
+
export function handleLoginError() {
|
|
125
|
+
notify({
|
|
126
|
+
type: "error",
|
|
127
|
+
title: "Login failed",
|
|
128
|
+
message: "We couldn't sign you in. Please try again.",
|
|
129
|
+
actions: [
|
|
130
|
+
{
|
|
131
|
+
label: "Retry",
|
|
132
|
+
variant: "primary",
|
|
133
|
+
onClick: () => console.log("retry login"),
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Configuration options
|
|
141
|
+
|
|
142
|
+
| Option | Type | Description |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| `placement` | `NotificationPlacement` | Controls where the stack renders (`top-right`, `bottom-left`, `center`, etc.). |
|
|
145
|
+
| `duration` | `number` | Auto-dismiss time in ms (`0` or `Infinity` disables). |
|
|
146
|
+
| `persistent` | `boolean` | Keeps the message open until dismissed. |
|
|
147
|
+
| `actions` | `NotificationAction[]` | Buttons/links with callbacks (e.g., Retry). |
|
|
148
|
+
| `content` | `ReactNode` | Custom body content for advanced layouts. |
|
|
149
|
+
| `containerClassName` | `string` | Customize the stack container styling. |
|
|
150
|
+
|
|
151
|
+
### Recommended follow-up tasks
|
|
152
|
+
|
|
153
|
+
Create sub-issues for the notification epic so teams can track separate scopes:
|
|
154
|
+
|
|
155
|
+
1. Design exploration (visual styles and variants).
|
|
156
|
+
2. Implementation checklists (API ergonomics, accessibility, animation polish).
|
|
157
|
+
3. Documentation expansion (Storybook examples + README).
|
|
158
|
+
4. Next.js usage examples (app router and pages router snippets).
|
|
159
|
+
|
|
72
160
|
## Follow company callbacks (CompanyCard + CompanyDetail)
|
|
73
161
|
|
|
74
162
|
The company list/detail components are stateless and emit follow actions so your app can handle API calls. Use the follow props to control state and provide callbacks for follow/unfollow actions.
|