Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Ensure React alphabetical ordering ignoring prefix #222

Merged
merged 1 commit into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ module.exports = function( grunt ) {
// Start the React component
content = grunt.file.read( 'sources/react/index-header.jsx' );

// Ensure alphabetical ordering ignoring prefix
svgFiles.sort( function( a, b ) {
return a.replace( /^gutenberg\//, '' ).localeCompare(
b.replace( /^gutenberg\//, '' )
);
} );

// Create a switch() case for each svg file
svgFiles.forEach( function( svgFile ) {
// Clean up the filename to use for the react components
Expand Down
2 changes: 1 addition & 1 deletion react/example.js

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions react/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ module.exports = React.createClass( {
<Dashicon icon="admin-users" size={ 40 } onClick={ this.handleClick.bind( this, 'admin-users' ) } />
<Dashicon icon="album" size={ 40 } onClick={ this.handleClick.bind( this, 'album' ) } />
<Dashicon icon="align-center" size={ 40 } onClick={ this.handleClick.bind( this, 'align-center' ) } />
<Dashicon icon="gutenberg/align-full-width" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/align-full-width' ) } />
<Dashicon icon="align-left" size={ 40 } onClick={ this.handleClick.bind( this, 'align-left' ) } />
<Dashicon icon="align-none" size={ 40 } onClick={ this.handleClick.bind( this, 'align-none' ) } />
<Dashicon icon="align-right" size={ 40 } onClick={ this.handleClick.bind( this, 'align-right' ) } />
<Dashicon icon="gutenberg/align-wide" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/align-wide' ) } />
<Dashicon icon="analytics" size={ 40 } onClick={ this.handleClick.bind( this, 'analytics' ) } />
<Dashicon icon="archive" size={ 40 } onClick={ this.handleClick.bind( this, 'archive' ) } />
<Dashicon icon="arrow-down-alt" size={ 40 } onClick={ this.handleClick.bind( this, 'arrow-down-alt' ) } />
Expand Down Expand Up @@ -77,6 +79,7 @@ module.exports = React.createClass( {
<Dashicon icon="buddipress-bbpress-logo" size={ 40 } onClick={ this.handleClick.bind( this, 'buddipress-bbpress-logo' ) } />
<Dashicon icon="building" size={ 40 } onClick={ this.handleClick.bind( this, 'building' ) } />
<Dashicon icon="businessman" size={ 40 } onClick={ this.handleClick.bind( this, 'businessman' ) } />
<Dashicon icon="gutenberg/button" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/button' ) } />
<Dashicon icon="calendar-alt" size={ 40 } onClick={ this.handleClick.bind( this, 'calendar-alt' ) } />
<Dashicon icon="calendar" size={ 40 } onClick={ this.handleClick.bind( this, 'calendar' ) } />
<Dashicon icon="camera" size={ 40 } onClick={ this.handleClick.bind( this, 'camera' ) } />
Expand All @@ -90,6 +93,7 @@ module.exports = React.createClass( {
<Dashicon icon="clipboard" size={ 40 } onClick={ this.handleClick.bind( this, 'clipboard' ) } />
<Dashicon icon="clock" size={ 40 } onClick={ this.handleClick.bind( this, 'clock' ) } />
<Dashicon icon="cloud" size={ 40 } onClick={ this.handleClick.bind( this, 'cloud' ) } />
<Dashicon icon="gutenberg/columns" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/columns' ) } />
<Dashicon icon="controls-back" size={ 40 } onClick={ this.handleClick.bind( this, 'controls-back' ) } />
<Dashicon icon="controls-forward" size={ 40 } onClick={ this.handleClick.bind( this, 'controls-forward' ) } />
<Dashicon icon="controls-pause" size={ 40 } onClick={ this.handleClick.bind( this, 'controls-pause' ) } />
Expand Down Expand Up @@ -135,6 +139,7 @@ module.exports = React.createClass( {
<Dashicon icon="editor-underline" size={ 40 } onClick={ this.handleClick.bind( this, 'editor-underline' ) } />
<Dashicon icon="editor-unlink" size={ 40 } onClick={ this.handleClick.bind( this, 'editor-unlink' ) } />
<Dashicon icon="editor-video" size={ 40 } onClick={ this.handleClick.bind( this, 'editor-video' ) } />
<Dashicon icon="gutenberg/ellipsis" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/ellipsis' ) } />
<Dashicon icon="email-alt" size={ 40 } onClick={ this.handleClick.bind( this, 'email-alt' ) } />
<Dashicon icon="email-alt2" size={ 40 } onClick={ this.handleClick.bind( this, 'email-alt2' ) } />
<Dashicon icon="email" size={ 40 } onClick={ this.handleClick.bind( this, 'email' ) } />
Expand All @@ -157,24 +162,11 @@ module.exports = React.createClass( {
<Dashicon icon="googleplus" size={ 40 } onClick={ this.handleClick.bind( this, 'googleplus' ) } />
<Dashicon icon="grid-view" size={ 40 } onClick={ this.handleClick.bind( this, 'grid-view' ) } />
<Dashicon icon="groups" size={ 40 } onClick={ this.handleClick.bind( this, 'groups' ) } />
<Dashicon icon="gutenberg/align-full-width" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/align-full-width' ) } />
<Dashicon icon="gutenberg/align-wide" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/align-wide' ) } />
<Dashicon icon="gutenberg/button" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/button' ) } />
<Dashicon icon="gutenberg/columns" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/columns' ) } />
<Dashicon icon="gutenberg/ellipsis" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/ellipsis' ) } />
<Dashicon icon="gutenberg/heading" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/heading' ) } />
<Dashicon icon="gutenberg/html" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/html' ) } />
<Dashicon icon="gutenberg/insert" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/insert' ) } />
<Dashicon icon="gutenberg/saved" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/saved' ) } />
<Dashicon icon="gutenberg/table-col-after" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-after' ) } />
<Dashicon icon="gutenberg/table-col-before" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-before' ) } />
<Dashicon icon="gutenberg/table-col-delete" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-delete' ) } />
<Dashicon icon="gutenberg/table-row-after" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-after' ) } />
<Dashicon icon="gutenberg/table-row-before" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-before' ) } />
<Dashicon icon="gutenberg/table-row-delete" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-delete' ) } />
<Dashicon icon="hammer" size={ 40 } onClick={ this.handleClick.bind( this, 'hammer' ) } />
<Dashicon icon="gutenberg/heading" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/heading' ) } />
<Dashicon icon="heart" size={ 40 } onClick={ this.handleClick.bind( this, 'heart' ) } />
<Dashicon icon="hidden" size={ 40 } onClick={ this.handleClick.bind( this, 'hidden' ) } />
<Dashicon icon="gutenberg/html" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/html' ) } />
<Dashicon icon="id-alt" size={ 40 } onClick={ this.handleClick.bind( this, 'id-alt' ) } />
<Dashicon icon="id" size={ 40 } onClick={ this.handleClick.bind( this, 'id' ) } />
<Dashicon icon="image-crop" size={ 40 } onClick={ this.handleClick.bind( this, 'image-crop' ) } />
Expand All @@ -188,6 +180,7 @@ module.exports = React.createClass( {
<Dashicon icon="images-alt2" size={ 40 } onClick={ this.handleClick.bind( this, 'images-alt2' ) } />
<Dashicon icon="index-card" size={ 40 } onClick={ this.handleClick.bind( this, 'index-card' ) } />
<Dashicon icon="info" size={ 40 } onClick={ this.handleClick.bind( this, 'info' ) } />
<Dashicon icon="gutenberg/insert" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/insert' ) } />
<Dashicon icon="laptop" size={ 40 } onClick={ this.handleClick.bind( this, 'laptop' ) } />
<Dashicon icon="layout" size={ 40 } onClick={ this.handleClick.bind( this, 'layout' ) } />
<Dashicon icon="leftright" size={ 40 } onClick={ this.handleClick.bind( this, 'leftright' ) } />
Expand Down Expand Up @@ -234,6 +227,7 @@ module.exports = React.createClass( {
<Dashicon icon="randomize" size={ 40 } onClick={ this.handleClick.bind( this, 'randomize' ) } />
<Dashicon icon="redo" size={ 40 } onClick={ this.handleClick.bind( this, 'redo' ) } />
<Dashicon icon="rss" size={ 40 } onClick={ this.handleClick.bind( this, 'rss' ) } />
<Dashicon icon="gutenberg/saved" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/saved' ) } />
<Dashicon icon="schedule" size={ 40 } onClick={ this.handleClick.bind( this, 'schedule' ) } />
<Dashicon icon="screenoptions" size={ 40 } onClick={ this.handleClick.bind( this, 'screenoptions' ) } />
<Dashicon icon="search" size={ 40 } onClick={ this.handleClick.bind( this, 'search' ) } />
Expand All @@ -252,6 +246,12 @@ module.exports = React.createClass( {
<Dashicon icon="star-half" size={ 40 } onClick={ this.handleClick.bind( this, 'star-half' ) } />
<Dashicon icon="sticky" size={ 40 } onClick={ this.handleClick.bind( this, 'sticky' ) } />
<Dashicon icon="store" size={ 40 } onClick={ this.handleClick.bind( this, 'store' ) } />
<Dashicon icon="gutenberg/table-col-after" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-after' ) } />
<Dashicon icon="gutenberg/table-col-before" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-before' ) } />
<Dashicon icon="gutenberg/table-col-delete" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-col-delete' ) } />
<Dashicon icon="gutenberg/table-row-after" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-after' ) } />
<Dashicon icon="gutenberg/table-row-before" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-before' ) } />
<Dashicon icon="gutenberg/table-row-delete" size={ 40 } onClick={ this.handleClick.bind( this, 'gutenberg/table-row-delete' ) } />
<Dashicon icon="tablet" size={ 40 } onClick={ this.handleClick.bind( this, 'tablet' ) } />
<Dashicon icon="tag" size={ 40 } onClick={ this.handleClick.bind( this, 'tag' ) } />
<Dashicon icon="tagcloud" size={ 40 } onClick={ this.handleClick.bind( this, 'tagcloud' ) } />
Expand Down
2 changes: 1 addition & 1 deletion react/index.js

Large diffs are not rendered by default.

Loading