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
Icon font to SVG migration part 1 #6107 #10277
Icon font to SVG migration part 1 #6107 #10277
Conversation
Manage this branch in SquashTest this branch here: https://thibaudcolas6107-icon-font-par-654r4.squash.io |
&:before { | ||
display: none; // TODO: remove when iconfont styles are removed | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All dropdown chevron icons are already converted so this doesn’t need to wait.
width: 1em; | ||
height: 1em; | ||
display: inline-block; | ||
background-color: currentColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in the icons looking more or less the same as before. I chose to keep those three "-after" icons done via CSS for two reasons:
- So this keeps working for people implementing listings by copy-pasting Wagtail’s own listings.
- So we introduce appropriate listing components in Universal listings roadmap#33
color: $color-grey-2; | ||
border: 1px solid currentColor; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn’t used, and wasn’t documented in our list of available icons.
&:before { | ||
font-size: 1.5em; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Icon size defined via a reusable icon-specific class.
vertical-align: -10%; | ||
content: map.get($icons, 'warning'); | ||
mask-image: url('#{$images-root}icons/warning.svg'); | ||
background-color: currentColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as -after
icons – a lot of people have "error-message" directly referenced in their templates, and we don’t have a reusable component for this, so keeping the icon in CSS for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove that line above while we're in this code.
// UI-Redesign: to be added via js and styled here
And maybe the Todo note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I don’t understand what it’s about so sounds sensible to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it's about how error message elements for StreamField are constructed? If I remember correctly, they're dynamically created on the client-side via JS as opposed to server-rendered.
@@ -113,7 +113,7 @@ describe('telepath: wagtail.blocks.ListBlock', () => { | |||
icon: 'placeholder', | |||
classname: null, | |||
helpText: 'use <strong>a few</strong> of these', | |||
helpIcon: '<div class="icon-help">?</div>', | |||
helpIcon: '<svg></svg>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outside of tests, helpIcon
renders an SVG icon since quite a few releases ago. I chose to use an empty <svg>
element as the exact markup is irrelevant here.
@@ -308,11 +308,8 @@ if (!wagtail.ui) { | |||
const DROPDOWN_SELECTOR = '[data-dropdown]'; | |||
const LISTING_TITLE_SELECTOR = '[data-listing-page-title]'; | |||
const LISTING_ACTIVE_CLASS = 'listing__item--active'; | |||
const ICON_DOWN = 'icon-arrow-down'; | |||
const ICON_UP = 'icon-arrow-up'; | |||
const IS_OPEN = 'is-open'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was all dead code. Dropdown up/down chevrons had already been rewritten to use the is-open
class only to determine which icon to show.
@@ -4,7 +4,7 @@ | |||
{% block titletag %}{% blocktrans trimmed with title=subtitle %}Page history for {{ subtitle }}{% endblocktrans %}{% endblock %} | |||
|
|||
{% block actions %} | |||
<a href="{% url 'wagtailadmin_pages:edit' page.id %}" class="button bicolor icon icon-edit">{% trans "Edit this page" %}</a> | |||
<a href="{% url 'wagtailadmin_pages:edit' page.id %}" class="button bicolor button--icon">{% icon name="edit" wrapped=1 %}{% trans "Edit this page" %}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note on wrapped=1
– not the nicest API but essentially this is needed for button--icon
buttons. The buttons look bigger like this than with the icon font, which we’ve accepted in other parts of the UI.
height: 100%; | ||
vertical-align: middle; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those have been replaced with the same -after
ordering icons as other listings.
@@ -44,8 +44,9 @@ | |||
{% endblock fields %} | |||
|
|||
<li> | |||
<a href="#tab-roles" data-tab-trigger class="button lowpriority icon icon-arrow-right-after"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn’t find a reference to lowpriority
anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a smoke test of all icon scenarios changed - did not see any issues. One minor comment.
Happy to approve but I see there are some CI items to fix still.
vertical-align: -10%; | ||
content: map.get($icons, 'warning'); | ||
mask-image: url('#{$images-root}icons/warning.svg'); | ||
background-color: currentColor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove that line above while we're in this code.
// UI-Redesign: to be added via js and styled here
And maybe the Todo note?
Thank you @lb-! The CI failures are just because I’ve cancelled the GitHub Actions builds, it’s all green in CircleCI (which is all that’s relevant for this kind of change) |
caf7eb0
to
ad26370
Compare
Assorted icon font -> SVG conversions as part of #6107. This is missing a few areas of the CMS still, which will come in a "part 2" (#10278). In particular workflows, ModelAdmin, and listings will be done in a separate PR.
This might be easier to review commit-by-commit – I’ll add comments directly in the PR for specific changes. At a high level:
mask-image
where inline SVGs would be impractical.[ ] For Python changes: Have you added tests to cover the new/fixed behaviour?[ ] For new features: Has the documentation been updated accordingly?