You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,7 +119,12 @@ The CI process should deploy a `blueprints.json` file to `/blueprints/blueprints
96
119
### Normal Operation
97
120
1. When the overlay loads, it fetches `/blueprints/blueprints.json`
98
121
2. If successful, buttons are created from the JSON data
99
-
3. Each button navigates to the specified `path` when clicked
122
+
3. Icons are resolved dynamically:
123
+
- If `icon` is omitted, uses `WordPressIcon` (default)
124
+
- If `icon` starts with `http://` or `https://`, loads as external SVG image
125
+
- If `icon` matches a component name in `@wp-playground/components`, uses that component
126
+
- If none of the above, falls back to `WordPressIcon`
127
+
4. Each button navigates to the specified `path` when clicked
100
128
101
129
### Fallback Mechanism
102
130
If the JSON file cannot be fetched (404, network error, etc.):
@@ -108,6 +136,11 @@ If the JSON file cannot be fetched (404, network error, etc.):
108
136
- Buttons appear immediately using defaults or fetched data
109
137
- This provides a seamless user experience
110
138
139
+
### Icon Support
140
+
Buttons can display custom icons in two ways:
141
+
1.**React Component Names**: Use exported icon components from `@wp-playground/components` (e.g., "WordPressIcon", "ClockIcon", "playgroundLogo")
142
+
2.**SVG URLs**: Provide a direct URL to an SVG file (e.g., "https://example.com/icon.svg")
143
+
111
144
## Testing
112
145
113
146
### Type Checking
@@ -138,12 +171,28 @@ npm run dev
138
171
139
172
4.**Validation**: Consider adding JSON schema validation in your CI process to ensure the file structure is correct before deployment
140
173
174
+
5.**Icon Support**: Icons can be specified as React component names (from `@wp-playground/components`) or as URLs to SVG files. External SVG icons must be accessible from the client (CORS considerations apply).
175
+
141
176
## Icon Customization
142
177
143
-
Currently, all buttons use the `WordPressIcon` component. If you need to support different icons in the future, you would need to:
144
-
1. Add an `icon` field to the `BlueprintButton` interface
145
-
2. Create a mapping of icon names to icon components
146
-
3. Update the button rendering logic to use the specified icon
178
+
Icons are now fully customizable via the `icon` field in the JSON configuration:
179
+
180
+
### Available React Component Icons
181
+
From `@wp-playground/components`:
182
+
-`WordPressIcon` - WordPress logo (default)
183
+
-`ClockIcon` - Clock icon
184
+
-`playgroundLogo` - Playground logo
185
+
-`temporaryStorage` - Temporary storage icon
186
+
187
+
### Using External SVG Icons
188
+
Provide a direct URL to an SVG file:
189
+
```json
190
+
{
191
+
"icon": "https://example.com/custom-icon.svg"
192
+
}
193
+
```
194
+
195
+
Note: External SVG icons must be accessible from the client browser. Ensure proper CORS headers are set if the SVG is hosted on a different domain.
0 commit comments