Skip to content

Commit 3519109

Browse files
authored
Command Palette: Use @wordpress/icons instead of Dashicons (#189)
1 parent 7b722ee commit 3519109

File tree

4 files changed

+143
-16
lines changed

4 files changed

+143
-16
lines changed

assets/src/js/commands/admin-commands.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { createElement } from '@wordpress/element';
1616
import { Icon } from '@wordpress/components';
1717
import { dispatch } from '@wordpress/data';
1818
import { addQueryArgs } from '@wordpress/url';
19+
import { layout, plus, postList, category, settings, tool, upload, download } from '@wordpress/icons';
1920

2021
/**
2122
* Register admin commands for SCF
@@ -34,7 +35,7 @@ const registerAdminCommands = () => {
3435
label: __( 'Field Groups', 'secure-custom-fields' ),
3536
url: 'edit.php',
3637
urlArgs: { post_type: 'acf-field-group' },
37-
icon: 'layout',
38+
icon: layout,
3839
description: __(
3940
'SCF: View and manage custom field groups',
4041
'secure-custom-fields'
@@ -51,7 +52,7 @@ const registerAdminCommands = () => {
5152
label: __( 'Create New Field Group', 'secure-custom-fields' ),
5253
url: 'post-new.php',
5354
urlArgs: { post_type: 'acf-field-group' },
54-
icon: 'plus',
55+
icon: plus,
5556
description: __(
5657
'SCF: Create a new field group to organize custom fields',
5758
'secure-custom-fields'
@@ -69,7 +70,7 @@ const registerAdminCommands = () => {
6970
label: __( 'Post Types', 'secure-custom-fields' ),
7071
url: 'edit.php',
7172
urlArgs: { post_type: 'acf-post-type' },
72-
icon: 'admin-post',
73+
icon: postList,
7374
description: __(
7475
'SCF: Manage custom post types',
7576
'secure-custom-fields'
@@ -81,7 +82,7 @@ const registerAdminCommands = () => {
8182
label: __( 'Create New Post Type', 'secure-custom-fields' ),
8283
url: 'post-new.php',
8384
urlArgs: { post_type: 'acf-post-type' },
84-
icon: 'plus',
85+
icon: plus,
8586
description: __(
8687
'SCF: Create a new custom post type',
8788
'secure-custom-fields'
@@ -93,7 +94,7 @@ const registerAdminCommands = () => {
9394
label: __( 'Taxonomies', 'secure-custom-fields' ),
9495
url: 'edit.php',
9596
urlArgs: { post_type: 'acf-taxonomy' },
96-
icon: 'category',
97+
icon: category,
9798
description: __(
9899
'SCF: Manage custom taxonomies for organizing content',
99100
'secure-custom-fields'
@@ -105,7 +106,7 @@ const registerAdminCommands = () => {
105106
label: __( 'Create New Taxonomy', 'secure-custom-fields' ),
106107
url: 'post-new.php',
107108
urlArgs: { post_type: 'acf-taxonomy' },
108-
icon: 'plus',
109+
icon: plus,
109110
description: __(
110111
'SCF: Create a new custom taxonomy',
111112
'secure-custom-fields'
@@ -124,7 +125,7 @@ const registerAdminCommands = () => {
124125
label: __( 'Options Pages', 'secure-custom-fields' ),
125126
url: 'edit.php',
126127
urlArgs: { post_type: 'acf-ui-options-page' },
127-
icon: 'admin-settings',
128+
icon: settings,
128129
description: __(
129130
'SCF: Manage custom options pages for global settings',
130131
'secure-custom-fields'
@@ -136,7 +137,7 @@ const registerAdminCommands = () => {
136137
label: __( 'Create New Options Page', 'secure-custom-fields' ),
137138
url: 'post-new.php',
138139
urlArgs: { post_type: 'acf-ui-options-page' },
139-
icon: 'plus',
140+
icon: plus,
140141
description: __(
141142
'SCF: Create a new custom options page',
142143
'secure-custom-fields'
@@ -148,7 +149,7 @@ const registerAdminCommands = () => {
148149
label: __( 'SCF Tools', 'secure-custom-fields' ),
149150
url: 'admin.php',
150151
urlArgs: { page: 'acf-tools' },
151-
icon: 'admin-tools',
152+
icon: tool,
152153
description: __(
153154
'SCF: Access SCF utility tools',
154155
'secure-custom-fields'
@@ -160,7 +161,7 @@ const registerAdminCommands = () => {
160161
label: __( 'Import SCF Data', 'secure-custom-fields' ),
161162
url: 'admin.php',
162163
urlArgs: { page: 'acf-tools', tool: 'import' },
163-
icon: 'upload',
164+
icon: upload,
164165
description: __(
165166
'SCF: Import field groups, post types, taxonomies, and options pages',
166167
'secure-custom-fields'
@@ -172,7 +173,7 @@ const registerAdminCommands = () => {
172173
label: __( 'Export SCF Data', 'secure-custom-fields' ),
173174
url: 'admin.php',
174175
urlArgs: { page: 'acf-tools', tool: 'export' },
175-
icon: 'download',
176+
icon: download,
176177
description: __(
177178
'SCF: Export field groups, post types, taxonomies, and options pages',
178179
'secure-custom-fields'

assets/src/js/commands/custom-post-type-commands.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { createElement } from '@wordpress/element';
1919
import { Icon } from '@wordpress/components';
2020
import { dispatch } from '@wordpress/data';
2121
import { addQueryArgs } from '@wordpress/url';
22+
import { page, plus, edit } from '@wordpress/icons';
2223

2324
/**
2425
* Register custom post type commands
@@ -46,7 +47,7 @@ const registerPostTypeCommands = () => {
4647
commandStore.registerCommand( {
4748
name: `scf/cpt-${ postType.name }`,
4849
label: postType.all_items,
49-
icon: createElement( Icon, { icon: 'admin-page' } ),
50+
icon: createElement( Icon, { icon: page } ),
5051
context: 'admin',
5152
description: postType.all_items,
5253
keywords: [
@@ -68,7 +69,7 @@ const registerPostTypeCommands = () => {
6869
commandStore.registerCommand( {
6970
name: `scf/new-${ postType.name }`,
7071
label: postType.add_new_item,
71-
icon: createElement( Icon, { icon: 'plus' } ),
72+
icon: createElement( Icon, { icon: plus } ),
7273
context: 'admin',
7374
description: postType.add_new_item,
7475
keywords: [
@@ -91,7 +92,7 @@ const registerPostTypeCommands = () => {
9192
commandStore.registerCommand( {
9293
name: `scf/edit-${ postType.name }`,
9394
label: sprintf(__('Edit post type: %s', 'secure-custom-fields'), postType.label),
94-
icon: createElement( Icon, { icon: 'edit' } ),
95+
icon: createElement( Icon, { icon: edit } ),
9596
context: 'admin',
9697
description: sprintf(__('Edit the %s post type settings', 'secure-custom-fields'), postType.label),
9798
keywords: [

package-lock.json

Lines changed: 126 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@babel/preset-react": "^7.25.7",
2020
"@wordpress/dependency-extraction-webpack-plugin": "^6.20.0",
2121
"@wordpress/e2e-test-utils-playwright": "^1.20.0",
22+
"@wordpress/icons": "^10.26.0",
2223
"@wordpress/prettier-config": "^4.22.0",
2324
"@wordpress/priority-queue": "^3.22.0",
2425
"@wordpress/scripts": "^30.14.0",

0 commit comments

Comments
 (0)