Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Dashicon component to rely on the font that ships with WordPress #20003

Merged
merged 6 commits into from
Sep 22, 2020
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
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function gutenberg_register_packages_styles( $styles ) {
$styles,
'wp-components',
gutenberg_url( 'build/components/style.css' ),
array(),
array( 'dashicons' ),
filemtime( gutenberg_dir_path() . 'build/components/style.css' )
);
$styles->add_data( 'wp-components', 'rtl', 'replace' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { _n, sprintf } from '@wordpress/i18n';
import { PluginPrePublishPanel } from '@wordpress/edit-post';
import { useSelect } from '@wordpress/data';
import { blockDefault } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -22,7 +23,7 @@ export default function InstalledBlocksPrePublishPanel() {

return (
<PluginPrePublishPanel
icon="block-default"
icon={ blockDefault }
title={ sprintf(
// translators: %d: number of blocks (number).
_n(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { isFunction } from 'lodash';
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { Button, Icon } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { createInterpolateElement } from '@wordpress/element';
import { Icon, plusCircle } from '@wordpress/icons';

export const LinkControlSearchCreate = ( {
searchTerm,
Expand Down Expand Up @@ -49,7 +50,7 @@ export const LinkControlSearchCreate = ( {
>
<Icon
className="block-editor-link-control__search-item-icon"
icon="insert"
icon={ plusCircle }
/>

<span className="block-editor-link-control__search-item-header">
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/columns/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { withDispatch, useSelect } from '@wordpress/data';
import { useEffect, useState, useMemo } from '@wordpress/element';
import { useResizeObserver } from '@wordpress/compose';
import { createBlock } from '@wordpress/blocks';
import { columns } from '@wordpress/icons';
/**
* Internal dependencies
*/
Expand Down Expand Up @@ -184,7 +185,7 @@ function ColumnsEditContainer( {
<PanelBody title={ __( 'Columns Settings' ) }>
<RangeControl
label={ __( 'Number of columns' ) }
icon="columns"
icon={ columns }
value={ columnCount }
onChange={ ( value ) =>
updateColumns( columnCount, value )
Expand Down
7 changes: 2 additions & 5 deletions packages/block-library/src/cover/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { useEffect, useState, useRef } from '@wordpress/element';
import { cover as icon, replace, image } from '@wordpress/icons';
import { cover as icon, replace, image, warning } from '@wordpress/icons';
import { getProtocol } from '@wordpress/url';

/**
Expand Down Expand Up @@ -536,10 +536,7 @@ const Cover = ( {
style={ styles.uploadFailedContainer }
>
<View style={ styles.uploadFailed }>
<Icon
icon={ 'warning' }
{ ...styles.uploadFailedIcon }
/>
<Icon icon={ warning } { ...styles.uploadFailedIcon } />
</View>
</View>
) }
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/gallery/gallery-image.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { Caption, MediaUploadProgress } from '@wordpress/block-editor';
import { getProtocol } from '@wordpress/url';
import { withPreferredColorScheme } from '@wordpress/compose';
import { arrowLeft, arrowRight } from '@wordpress/icons';
import { arrowLeft, arrowRight, warning } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -239,7 +239,7 @@ class GalleryImage extends Component {
<View style={ style.uploadFailedContainer }>
<View style={ style.uploadFailed }>
<Icon
icon={ 'warning' }
icon={ warning }
{ ...style.uploadFailedIcon }
/>
</View>
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
image as placeholderIcon,
textColor,
replace,
expand,
} from '@wordpress/icons';

/**
Expand Down Expand Up @@ -409,7 +410,7 @@ export class ImageEdit extends React.Component {
/>
{ image && sizeOptionsValid && (
<CycleSelectControl
icon={ 'editor-expand' }
icon={ expand }
label={ __( 'Size' ) }
value={ sizeSlug || DEFAULT_SIZE_SLUG }
onChangeValue={ ( newValue ) =>
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/post-date/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
CustomSelectControl,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { edit } from '@wordpress/icons';

export default function PostDateEdit( { attributes, context, setAttributes } ) {
const { textAlign, format } = attributes;
Expand Down Expand Up @@ -69,7 +70,7 @@ export default function PostDateEdit( { attributes, context, setAttributes } ) {
{ date && (
<ToolbarGroup>
<ToolbarButton
icon="edit"
icon={ edit }
title={ __( 'Change Date' ) }
onClick={ () =>
setIsPickerOpen(
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
__experimentalBlock as Block,
} from '@wordpress/block-editor';
import { useSelect, useDispatch } from '@wordpress/data';
import { trash } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -302,7 +303,7 @@ export default function LogoEdit( {
) }
{ !! logoUrl && (
<ToolbarButton
icon="trash"
icon={ trash }
onClick={ () => deleteLogo() }
label={ __( 'Delete Site Logo' ) }
/>
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Breaking Change

- `NumberControl` no longer automatically transforms values when rendering `value` into a `<input />` HTML element.
- `Dashicon` component no longer renders SVGs. If you rely on this component, make sure to load the dashicon font.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have gone under Unreleased?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, mistake 😬

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I bumped the major version in last week's release 😄


## 9.6.0 (2020-05-14)

Expand Down
15 changes: 10 additions & 5 deletions packages/components/src/combobox-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
import { useCombobox } from 'downshift';
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { chevronDown, check, Icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import { Button, Dashicon } from '../';
import { Button } from '../';

const itemToString = ( item ) => item && item.name;
export default function ComboboxControl( {
Expand Down Expand Up @@ -86,8 +91,8 @@ export default function ComboboxControl( {
className: 'components-combobox-control__button-button',
} ) }
>
<Dashicon
icon="arrow-down-alt2"
<Icon
icon={ chevronDown }
className="components-combobox-control__button-icon"
/>
</Button>
Expand All @@ -112,8 +117,8 @@ export default function ComboboxControl( {
} ) }
>
{ item === selectedItem && (
<Dashicon
icon="saved"
<Icon
icon={ check }
className="components-combobox-control__item-icon"
/>
) }
Expand Down
Loading