@igamingcareer/igaming-components 1.0.64 → 1.0.66
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 -0
- package/dist/index.js +1590 -1592
- package/dist/index.mjs +17920 -18967
- 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
|