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

Colors Selector: replace Aa text by SVG icon #18222

Merged
merged 4 commits into from Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -7,11 +7,30 @@ import { noop } from 'lodash';
/**
* WordPress dependencies
*/
import { IconButton, Dropdown, Toolbar } from '@wordpress/components';
import { IconButton, Dropdown, Toolbar, SVG } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { DOWN } from '@wordpress/keycodes';
import { ColorPaletteControl, ContrastChecker } from '@wordpress/block-editor';

const ColorSelectorSVGIcon = () => (
<SVG
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
>
<text
transform="translate(-63 -14)"
fillRule="evenodd"
fontFamily="SFUIText-Bold, SF UI Text"
fontSize="12"
fontWeight="bold"
letterSpacing="-.5"
alignmentBaseline="middle"
>
<tspan x="63.453" y="23">Aa</tspan>
</text>
</SVG>
);

/**
* Color Selector Icon component.
*
Expand All @@ -20,10 +39,10 @@ import { ColorPaletteControl, ContrastChecker } from '@wordpress/block-editor';
const ColorSelectorIcon = ( { style } ) =>
<div className="block-library-colors-selector__icon-container">
<div
className="block-library-colors-selector__state-selection wp-block-navigation-menu-item"
className="block-library-colors-selector__state-selection"
style={ style }
>
Aa
<ColorSelectorSVGIcon />
</div>
</div>;

Expand Down
12 changes: 7 additions & 5 deletions packages/block-library/src/navigation-menu/editor.scss
Expand Up @@ -113,11 +113,6 @@ $colors-selector-size: 22px;

// colors-selector - selection status.
.block-library-colors-selector__state-selection {
font-size: 11px;
font-style: normal;
font-family: inherit;
font-weight: 600;

border-radius: $colors-selector-size / 2;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);

Expand All @@ -127,6 +122,13 @@ $colors-selector-size: 22px;
min-height: $colors-selector-size;
line-height: ($colors-selector-size - 2);

// Adjust `Aa` icon position.
> svg {
position: relative;
top: 4px;
left: 2px;
}

background-color: var(--background-color-menu-link);
color: var(--color-menu-link);
}
Expand Down