@igamingcareer/igaming-components 1.0.65 → 1.0.67
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 +70 -27
- package/dist/index.js +1590 -1592
- package/dist/index.mjs +17453 -18558
- package/package.json +6 -6
package/Readme.md
CHANGED
|
@@ -69,6 +69,76 @@ export function Example() {
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
## Tag badge and tag picker
|
|
73
|
+
|
|
74
|
+
Use the `TagBadge` component to display tags (for job cards, filters, etc.) and the `TagPicker` component to select or create tags.
|
|
75
|
+
|
|
76
|
+
### Example 1: Basic tag badge
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { TagBadge } from "@igamingcareer/igaming-components";
|
|
80
|
+
|
|
81
|
+
export function TagBadgeExample() {
|
|
82
|
+
return <TagBadge name="Remote" color="#10B981" size="sm" />;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Example 2: Removable and clickable tag badge
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { TagBadge } from "@igamingcareer/igaming-components";
|
|
90
|
+
|
|
91
|
+
export function InteractiveTagBadge() {
|
|
92
|
+
return (
|
|
93
|
+
<TagBadge
|
|
94
|
+
name="Interview"
|
|
95
|
+
color="#F59E0B"
|
|
96
|
+
size="md"
|
|
97
|
+
removable
|
|
98
|
+
onRemove={() => console.log("remove tag")}
|
|
99
|
+
onClick={() => console.log("badge clicked")}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Example 3: Tag picker with inline creation
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { useState } from "react";
|
|
109
|
+
import { TagPicker } from "@igamingcareer/igaming-components";
|
|
110
|
+
|
|
111
|
+
const initialTags = [
|
|
112
|
+
{ id: "1", name: "Remote", color: "#10B981" },
|
|
113
|
+
{ id: "2", name: "Urgent", color: "#EF4444" },
|
|
114
|
+
{ id: "3", name: "Interview", color: "#F59E0B", category: "Stage" },
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
export function TagPickerExample() {
|
|
118
|
+
const [tags, setTags] = useState(initialTags);
|
|
119
|
+
const [selectedTagIds, setSelectedTagIds] = useState<string[]>(["1"]);
|
|
120
|
+
|
|
121
|
+
const handleCreateTag = async ({ name, color }: { name: string; color: string }) => {
|
|
122
|
+
const nextTag = { id: String(Date.now()), name, color };
|
|
123
|
+
setTags((prev) => [...prev, nextTag]);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<TagPicker
|
|
128
|
+
availableTags={tags}
|
|
129
|
+
selectedTagIds={selectedTagIds}
|
|
130
|
+
onTagSelect={(tagId) => setSelectedTagIds((prev) => [...prev, tagId])}
|
|
131
|
+
onTagDeselect={(tagId) =>
|
|
132
|
+
setSelectedTagIds((prev) => prev.filter((id) => id !== tagId))
|
|
133
|
+
}
|
|
134
|
+
onCreateTag={handleCreateTag}
|
|
135
|
+
maxTags={8}
|
|
136
|
+
placeholder="Add tags to this job..."
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
72
142
|
### Sign-in prompt modal for gated actions
|
|
73
143
|
|
|
74
144
|
Use the `SignInPromptModal` to nudge unauthenticated users to log in or create an account before performing actions such as
|
|
@@ -177,30 +247,3 @@ Key events include:
|
|
|
177
247
|
- News Listing: search submissions/removals, filter select/clear/all-clear, date changes, category selection, pagination, view mode, items per page, article open/bookmark/share.
|
|
178
248
|
|
|
179
249
|
When embedding via `renderMultiple` (see `src/main.tsx`), a global `window.IGC_EMIT_EVENT` handler will be passed automatically if present, along with a default context using the current route and optional `data-source` attribute.
|
|
180
|
-
|
|
181
|
-
## Job Listing pagination-friendly API responses
|
|
182
|
-
|
|
183
|
-
The `<Listing />` component now understands paginated API payloads. Set `apiProvidesPagination` (or the `data-api-pagination="true"` attribute when embedding) to tell the component your endpoint returns a `{ jobs: [], pagination: { page, limit, total, total_pages } }` envelope.
|
|
184
|
-
|
|
185
|
-
- The component requests page `1` with `limit` set to the initial `itemsPerPage` value, reads the `pagination.total`/`total_pages` metadata, and then sequentially loads every remaining page to build the full `jobs[]` in memory.
|
|
186
|
-
- While those pages are fetched, the UI stays in the loading state (using the first batch size for the skeleton), and once all pages are collected it serves the same client-side pagination experience as array-based responses.
|
|
187
|
-
- If the flag is omitted, the component assumes a plain array response and paginates client-side as before.
|
|
188
|
-
|
|
189
|
-
Example response shape:
|
|
190
|
-
|
|
191
|
-
```json
|
|
192
|
-
{
|
|
193
|
-
"jobs": [/* job objects for the current page */],
|
|
194
|
-
"pagination": {
|
|
195
|
-
"page": 1,
|
|
196
|
-
"limit": 5,
|
|
197
|
-
"total": 2284,
|
|
198
|
-
"total_pages": 457
|
|
199
|
-
},
|
|
200
|
-
"metadata": {
|
|
201
|
-
"cache_hit": false
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
If your API still returns a plain array, leave `apiProvidesPagination` unset and the component will paginate client-side as before.
|