-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add new "Icons" page for icons customisation and reuse across the admin interface #6028
Conversation
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.
Great docs @allcaps!
ea3aeff
to
350d896
Compare
docs/advanced_topics/icons.rst
Outdated
|
||
The SVG should: | ||
|
||
- Have a size of 16x16 points |
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.
It is unclear to me what 16x16 points means. Is it the viewbox?
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.
Yes. I added an example.
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.
Cheers @allcaps!
I feel this may prove tricky for non-SVG proficient developers who just want to use a FontAwesome icon (e.g. https://fontawesome.com/icons/clipboard-list has a viewbox of 0 0 384 512
(and I, for example don't have the tools to convert it to a 0 0 16 16
viewbox. Changing the value ends up with a blank icon)
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'm not sure the same size matters that much as the final size is defined in CSS.
Maybe the ratio is significant. But I'm not sure about that too. I have to experiment.
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.
aside from this line which is confusing, the rest LGTM and ready to be merged on my opinion
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 am experiencing the same issue. Trying to use fork-awesome icons which look like this:
<svg width="1536" height="1536" xmlns="http://www.w3.org/2000/svg">
<path d="M1401 1547l-6 6c-75 ... " />
</svg>
Simply removing the width, height, and xmlns attributes and adding viewbox="0 0 16 16"
does not scale it correctly. I'm not sure what kind of tools or attributes should be used to convert an existing SVG into a wagtail-flavored SVG.
Hi, it's been a year, any progress on this? |
One thing we've tended to miss when adding icons to Wagtail is ensuring that any necessary attribution is in place (which is a requirement for Font Awesome v5 - see #7377). It would be good if we could find somewhere in these docs to put a reminder of this. This might be something that's better suited for a page in "Contributing to Wagtail" though - it looks like these docs are primarily aimed at people adding icons for their own purposes (including third-party packages). |
docs/advanced_topics/icons.rst
Outdated
{% icon name="rocket" classname="..." title="Launch" %} | ||
|
||
|
||
Icon font support |
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 add a note here that icon fonts cannot be used for icon
attributes on Streamfield blocks (not sure if this also applies to other icon attributes defined in Python code)
@allcaps this could use a rebase and I think it is high time we merge this in as menus, streamfields and quite a lot of UI components use the SVG icons now |
45c396e
to
c0b756a
Compare
Manage this branch in SquashTest this branch here: https://allcapssvg-icon-docs-1a1e7.squash.io |
@zerolab Rebased! I've included code snippets to give easy access to the available icon names and provide a example. Should we drop the section about icon fonts? |
- Preserve the existing `class_name` behaviour in most other cases - Update only docs reference to use `classname` - Relates to wagtail#6107 & wagtail#6028
f6c8f75
to
efb8911
Compare
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.
LGTM!
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.
Just had another read - also looks great. Thanks @allcaps !
@zerolab Go for it 👍 |
Merging now! I believe there is still work to be done on this to be honest, but we’re hoping to push for this to happen by the next release, and if this fails we can add a disclaimer. I wouldn’t recommend us backporting this. The documented setup here isn’t compatible with all of our icons, which is part of the reason why #6107 is still only halfway through the list. We have two solid approaches to solving this mentioned in #7511 that should work without changes to how icons are registered, but they’re just ideas/prototypes at this stage. |
efb8911
to
a18ae51
Compare
Thanks Thibaud |
Docs draft for #4821