@web-portfolio/icons-sanity 0.1.0 → 1.0.0
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 +91 -37
- package/dist/index.cjs +1623 -670
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +1637 -672
- package/package.json +5 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,35 +1,50 @@
|
|
|
1
1
|
# @web-portfolio/icons-sanity
|
|
2
2
|
|
|
3
|
-
A [Sanity Studio](https://www.sanity.io) plugin that adds
|
|
4
|
-
field
|
|
5
|
-
|
|
6
|
-
SVG
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
A [Sanity Studio](https://www.sanity.io) plugin that adds a proper icon
|
|
4
|
+
picker field to your schema, backed by the same **633-icon** library as
|
|
5
|
+
[`@web-portfolio/icons`](https://www.npmjs.com/package/@web-portfolio/icons).
|
|
6
|
+
It exists because "paste an SVG into a text field" is a bad experience for
|
|
7
|
+
content editors — they either need to know what valid SVG markup looks
|
|
8
|
+
like, or they need you to do it for them every time a new skill or social
|
|
9
|
+
link gets added. This plugin turns that into: click the field, search,
|
|
10
|
+
pick an icon, done.
|
|
11
|
+
|
|
12
|
+
**[Browse the icon set →](https://icons.getresume.dev)** before you install,
|
|
13
|
+
to see exactly what your editors will be choosing from.
|
|
10
14
|
|
|
11
15
|
[](https://www.npmjs.com/package/@web-portfolio/icons-sanity)
|
|
12
16
|
[](https://github.com/jatinrao/icons/blob/main/LICENSE)
|
|
13
17
|
|
|
18
|
+
[](https://icons.getresume.dev)
|
|
19
|
+
|
|
14
20
|
## Why this plugin
|
|
15
21
|
|
|
16
|
-
If you'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- **
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
If you've built a portfolio, agency site, or any Sanity project with a
|
|
23
|
+
"skills" or "tech stack" or "connect with us" section, you've probably
|
|
24
|
+
built some version of an icon field before. This plugin is meant to save
|
|
25
|
+
you from doing that again:
|
|
26
|
+
|
|
27
|
+
- **633 icons, ready to search.** Tech-stack logos, social platform icons,
|
|
28
|
+
and everyday UI icons — editors search by name, label, or tag, and can
|
|
29
|
+
narrow to a category, no SVG knowledge required.
|
|
30
|
+
- **Results ranked, not just filtered.** Typing `go` leads with `go`, not
|
|
31
|
+
`godot` — exact matches first, then name prefixes, then everything that
|
|
32
|
+
merely mentions the term.
|
|
33
|
+
- **Nothing fetched while editing.** The whole registry is bundled into the
|
|
34
|
+
plugin at build time, so the picker opens instantly and works even if
|
|
35
|
+
Studio is running offline.
|
|
36
|
+
- **Stores a name, not a blob.** The field value is a plain string
|
|
37
|
+
(`"react"`, `"github"`) rather than raw markup or an asset reference,
|
|
38
|
+
which pairs directly with `@web-portfolio/icons`'s `<Icon name="..." />`
|
|
39
|
+
on your frontend — no lookups, no asset resolution, just the name.
|
|
40
|
+
- **Shows what's selected.** The current icon renders inline in the form
|
|
41
|
+
alongside its label, category, and the exact string that got stored — so
|
|
42
|
+
editors can confirm at a glance they picked the right one.
|
|
43
|
+
- **Built entirely from Sanity UI.** `Card`, `Dialog`, `Badge`, `Select`,
|
|
44
|
+
`TextInput`, `Tooltip` and `@sanity/icons`, sized off the Sanity UI space
|
|
45
|
+
scale. It inherits your Studio's theme and light/dark scheme instead of
|
|
46
|
+
fighting it, and respects `readOnly` fields and Studio's focus/presence
|
|
47
|
+
tracking like a built-in input.
|
|
33
48
|
|
|
34
49
|
## Installation
|
|
35
50
|
|
|
@@ -42,7 +57,8 @@ pnpm add @web-portfolio/icons-sanity
|
|
|
42
57
|
```
|
|
43
58
|
|
|
44
59
|
Peer dependencies (already present in any standard Sanity Studio v3 project):
|
|
45
|
-
`sanity >=3`, `@sanity/ui >=2`,
|
|
60
|
+
`sanity >=3`, `@sanity/ui >=2`, `@sanity/icons >=3`, `react >=18`,
|
|
61
|
+
`styled-components >=6`.
|
|
46
62
|
|
|
47
63
|
## Setup
|
|
48
64
|
|
|
@@ -84,9 +100,40 @@ export default defineType({
|
|
|
84
100
|
})
|
|
85
101
|
```
|
|
86
102
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
string — e.g. `"react"`.
|
|
103
|
+
In Studio, that renders as a field editors click to open a searchable grid.
|
|
104
|
+
They type "react" or "docker" or "mail", pick a result, and the field
|
|
105
|
+
stores that icon's name as a plain string — e.g. `"react"`.
|
|
106
|
+
|
|
107
|
+
### What editors see
|
|
108
|
+
|
|
109
|
+
- The collapsed field shows the chosen icon, its label, its source category,
|
|
110
|
+
and the raw string stored in the document.
|
|
111
|
+
- Clicking **Select icon** / **Change icon** opens a dialog with a search
|
|
112
|
+
field and a category dropdown (Devicon, Material, Social, Tools, …).
|
|
113
|
+
Results render a page at a time so the dialog opens instantly even though
|
|
114
|
+
the whole 633-icon set is in memory.
|
|
115
|
+
- Hovering a tile reveals its registry name — the exact value that gets
|
|
116
|
+
saved.
|
|
117
|
+
- A `readOnly` field (schema-level, or a role without write access) disables
|
|
118
|
+
both actions and emits no patches.
|
|
119
|
+
- If a document holds a name that is no longer in the bundled set — say the
|
|
120
|
+
icon was renamed upstream — the field says so explicitly instead of
|
|
121
|
+
rendering an empty box, and offers to replace or clear it.
|
|
122
|
+
|
|
123
|
+
### Building your own input
|
|
124
|
+
|
|
125
|
+
If `iconRef` isn't the shape you want, the pieces are exported so you can
|
|
126
|
+
wire the same picker into a custom schema type or reuse its matching logic:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import {
|
|
130
|
+
IconPickerInput, // the input component itself
|
|
131
|
+
formatCategoryLabel, // "original" -> "Devicon"
|
|
132
|
+
matchesQuery, // name/label/tag matching
|
|
133
|
+
rankMatch, // relevance score, lower is better
|
|
134
|
+
type IconEntry, // the shape matchesQuery/rankMatch expect
|
|
135
|
+
} from '@web-portfolio/icons-sanity'
|
|
136
|
+
```
|
|
90
137
|
|
|
91
138
|
### Social/contact links example
|
|
92
139
|
|
|
@@ -110,8 +157,10 @@ defineField({
|
|
|
110
157
|
|
|
111
158
|
### Rendering the picked icon on your frontend
|
|
112
159
|
|
|
113
|
-
|
|
114
|
-
|
|
160
|
+
This is the part that makes the whole thing worth it — pair with
|
|
161
|
+
[`@web-portfolio/icons`](https://www.npmjs.com/package/@web-portfolio/icons)
|
|
162
|
+
and pass the stored string straight through as `name`, no transformation
|
|
163
|
+
needed:
|
|
115
164
|
|
|
116
165
|
```tsx
|
|
117
166
|
import { Icon } from '@web-portfolio/icons'
|
|
@@ -128,16 +177,21 @@ function SkillBadge({ skill }: { skill: { name: string; icon: string } }) {
|
|
|
128
177
|
|
|
129
178
|
## What's in the icon set
|
|
130
179
|
|
|
131
|
-
|
|
180
|
+
633 icons from three sources, shared with `@web-portfolio/icons`:
|
|
132
181
|
|
|
133
182
|
- **[devicon](https://github.com/devicons/devicon)** (578 icons, MIT) —
|
|
134
183
|
programming languages, frameworks, databases, cloud platforms, dev tools.
|
|
135
|
-
- **[Material Symbols](https://github.com/marella/material-symbols)** (
|
|
136
|
-
icons, Apache-2.0) —
|
|
137
|
-
|
|
138
|
-
- **[Simple Icons](https://simpleicons.org)** (
|
|
139
|
-
|
|
140
|
-
|
|
184
|
+
- **[Material Symbols](https://github.com/marella/material-symbols)** (38
|
|
185
|
+
icons, Apache-2.0) — everyday UI icons: mail, call, arrows, menu, close,
|
|
186
|
+
connected TV, bolt, translate, checklist, gift, and more.
|
|
187
|
+
- **[Simple Icons](https://simpleicons.org)** (17 icons, CC0-1.0) — social
|
|
188
|
+
platforms and dev-tool brands devicon doesn't cover (Instagram, YouTube,
|
|
189
|
+
WhatsApp, MCP, LangChain, Ollama, and more).
|
|
190
|
+
|
|
191
|
+
Not sure exactly what's in there? The
|
|
192
|
+
[gallery](https://icons.getresume.dev) is the fastest way to check — search
|
|
193
|
+
or filter by category to see every icon before you commit to using it in a
|
|
194
|
+
schema.
|
|
141
195
|
|
|
142
196
|
## License
|
|
143
197
|
|