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

feat(@clayui/css): LPD-4556 Convert SVG icons to 16x16 #5810

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pat270
Copy link
Member

@pat270 pat270 commented Apr 18, 2024

https://liferay.atlassian.net/browse/LPD-4556

I'm marking this as draft because we have some inconsistencies in naming, missing 16x16 icons, and questions about what to do with deprecated icons. The table below shows the naming conflicts Lexicon has with Clay. Lexicon needs to rename them so it matches Clay due to backward compatibility issues. I'm good with Lexicon prefixing with icon- but the rest of the name should match.

Lexicon should rename to match Clay Clay icon names
icon-document-vectorial.svg document-vector.svg
icon-field.svg Doesn't exist in Clay
icon-info-circle-full.svg info-circle.svg ?
icon-info-circle-line.svg info-circle-open.svg ?
icon-info-circle-open.svg info-panel-open.svg ?
icon-lock-wireless.svg Doesn't exist in Clay
icon-oauth2.svg oauth.svg
icon-openID open-id.svg
icon-page-tree.svg pages-tree.svg
icon-paste-plain-text.svg paste-plaintext.svg
icon-rule-builder.svg should be rule-builder.svg was added as icon-rule-builder.svg
icon-square-hole-multiple.svg square-hole-multi.svg
icon-thumb-up-arrow.svg thumbs-up-arrow.svg
icon-twitter-x.svg Should be social-twitter-x.svg, there was a mistake and we didn't prefix it

This next table lists icons that are in Clay but doesn't exist in the Lexicon Figma Library. They haven't been deprecated.

Clay icons that aren't in Lexicon Comments
add-role.svg
anonymize.svg
bell-full.svg
change-list-disabled.svg
comments.svg
custom-field.svg
devices.svg
diagnol-line.svg
environment-connected.svg
environment-disconnected.svg
environment.svg
flags-fr-ca.svg This is the Canadian flag, should we duplicate it in Lexicon?
flags-sr-RS-latin.svg Should we duplicate sr-RS flag in Lexicon?
flags-ta-IN.svg Should be duplicate hi-IN in Lexicon?
info-circle.svg
info-panel-closed.svg
info-panel-open.svg
megaphone-full.svg
minus-circle.svg
pin-full.svg
remove-role.svg
reset.svg
share-alt.svg
sign-in.svg
social-twitter.svg
sticky.svg
third-party.svg

Lastly, what should we do about deprecated icons? My gut says it's dangerous to remove them, but I'd like opinions on this.

Deprecated icons in Clay Status Replacement Comments
announcement.svg deprecated megaphone-full.svg We need megaphone-full.svg from Lexicon
desktop.svg deprecated display-content.svg No action needs to be taken
import-export.svg deprecated order-arrow.svg No action needs to be taken
embed.svg deprecated code.svg No action needs to be taken
social-twitter.svg active Should be deprecated? If not we need a 16x16 version from Lexicon
sticky.svg deprecated pin-full.svg We need pin-full.svg from Lexicon
twitter.svg deprecated social-twitter.svg We need social-twitter.svg from Lexicon
urgent.svg deprecated bell-full.svg We need bell-full.svg from Lexicon

/cc @matuzalemsteles @ethib137 @marcoscv-work

@matuzalemsteles
Copy link
Member

For the deprecated icons I would say that we can still keep them and remove them in the future major version, it seems safer, we can now add a warning in the documentation for the deprecated icons.

For Lexicon I'm not sure if it needs to update the icon names especially if it's just the file names, I think the designers just use the names in Figma now if the Figma name is different from what exists in Clay I think we can discuss and understand the best option here, mainly because the nomenclature in Clay or Lexicon can be strange so we need to discuss and reach a common sense what we should do about the names you listed.

For these icons that don't exist in Lexicon, maybe because they were removed or the name is different?

@pat270
Copy link
Member Author

pat270 commented Apr 19, 2024

For the deprecated icons I would say that we can still keep them and remove them in the future major version, it seems safer, we can now add a warning in the documentation for the deprecated icons.

The problem is the deprecated icons are 512 x 512. Lexicon will need to create these icons in 16x16.

For these icons that don't exist in Lexicon, maybe because they were removed or the name is different?

I checked and they're not in the Figma.

One thing I forgot the mention is it's pretty easy to convert 16 x 16 to 512 x 512 from the Figma file. Maybe we don't need to make the 16x16 change.

@matuzalemsteles
Copy link
Member

The problem is the deprecated icons are 512 x 512. Lexicon will need to create these icons in 16x16.

Hmm I think we can convert these icons to 16x16 just by changing the size I think there shouldn't be any problems especially if the icons and borders are drawn with just the path instead of the figma resource so decreasing the icon in proportion should work fine.

One thing I forgot the mention is it's pretty easy to convert 16 x 16 to 512 x 512 from the Figma file. Maybe we don't need to make the 16x16 change.

I don't remember exactly why but why do we want to have 16x16 icons?

@pat270
Copy link
Member Author

pat270 commented Apr 22, 2024

I don't remember exactly why but why do we want to have 16x16 icons?

@matuzalemsteles the icons in the Figma Library is 16x16. It's to keep things consistent. The only problem I run into is exporting the whole library. As of now, I need to change the width and height of the icon in the Figma and export them individually. It's not a problem if there's only a few icons we add each time.

@pat270
Copy link
Member Author

pat270 commented Apr 23, 2024

@matuzalemsteles I dug a little bit deeper in Portal and it looks like we can interchange 16x16 and 512x512. I'll update this pr and test it.

@pat270 pat270 marked this pull request as ready for review April 24, 2024 20:16
@pat270
Copy link
Member Author

pat270 commented Apr 24, 2024

This is ready for review. I was able to test in most places and it seems to work fine regardless of having viewBox="0 0 16 16" or viewBox="0 0 512 512". I also tested icons served from CDN. We should probably remove https://github.com/liferay/liferay-portal/blob/3dfc363015a7a315d3bc7688dd78179a41171c95/modules/apps/frontend-taglib/frontend-taglib-clay/src/main/java/com/liferay/frontend/taglib/clay/servlet/taglib/IconTag.java#L31.

Copy link
Member

@matuzalemsteles matuzalemsteles left a comment

Choose a reason for hiding this comment

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

@pat270 I only checked a few icons to be precise, there only 52 and it seems that some icons were converted wrong with some errors, there should probably be more like this, I believe that checking the diff in VS Code should be faster than in the browser unfortunately because If there are too many files, the browser starts to slow down and the window crashes...

But basically they seem to be common errors:

  • Icon not positioned correctly within the viewbox
  • Icon with a larger path than before, for example, big border.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8.792 6.982 1.72-.608L11 7.901l-1.748.593 1.096 1.559-1.229.95-1.126-1.574-1.097 1.573-1.23-.967 1.082-1.542L5 7.9l.473-1.526 1.735.608v-1.98h1.585v1.98Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

It seems that the icon is smaller within the 16 16 viewbox when comparing it to the same size.
Screenshot 2024-04-25 at 15 51 45

Copy link
Member Author

Choose a reason for hiding this comment

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

@matuzalemsteles this is how it is in the Figma file. We need to ask @drakonux @marcoscv-work.

Copy link
Member

Choose a reason for hiding this comment

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

Oh okay. I would say that this looks wrong because when the icon size is smaller we will almost not see the icon and this can probably cause visual alignment problems. But let's wait if this is expected.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M12.31 2.003H6.231c-.93 0-1.692.771-1.692 1.714V9.76a2.2 2.2 0 0 0-.423-.043c-1.169 0-2.115.959-2.115 2.143 0 1.184.946 2.143 2.115 2.143 1.169 0 2.115-.96 2.115-2.143V6.288h6.077v2.615a2.201 2.201 0 0 0-.423-.043c-1.168 0-2.115.959-2.115 2.143 0 1.184.947 2.142 2.115 2.142 1.17 0 2.116-.958 2.116-2.142V3.717c0-.943-.762-1.714-1.693-1.714Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

same here

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8.672 10.56 4.05-4.11c.793-.844-.285-1.99-1.063-1.165L8 9.008 4.3 5.263c-.721-.768-1.781.415-1.056 1.186l4.06 4.12c.489.532.786.62 1.369-.01Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

The border appears larger than it was.
Screen Shot 2024-04-25 at 4 00 27 PM

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m5.44 8.672 4.11 4.05c.844.793 1.99-.285 1.165-1.063L6.992 8l3.745-3.7c.768-.721-.415-1.781-1.186-1.056l-4.12 4.06c-.532.489-.62.786.01 1.369Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

The border appears larger than it was.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8.52 12.769 6.247-6.383c.711-.747-.367-1.894-1.084-1.139L8 11.033 2.321 5.251c-.726-.76-1.798.395-1.088 1.14l6.245 6.378c.312.322.754.294 1.041 0Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

Icon is not centered in the viewbox.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m10.56 7.328-4.11-4.05c-.844-.793-1.99.285-1.165 1.063L9.008 8l-3.745 3.7c-.768.721.415 1.781 1.186 1.056l4.12-4.06c.532-.489.62-.786-.01-1.369Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

The border appears larger than it was.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m8.672 5.44 4.05 4.11c.793.844-.285 1.99-1.063 1.165L8 6.992l-3.7 3.745c-.721.768-1.781-.415-1.056-1.186l4.06-4.12c.489-.532.786-.62 1.369.01Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

The border appears larger than it was.

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M7.48 3.231 1.235 9.608c-.714.743.358 1.897 1.088 1.142L8 4.967l5.683 5.786c.717.756 1.795-.395 1.084-1.138L8.52 3.23c-.288-.294-.73-.322-1.039 0Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

Icon is not centered in the viewbox

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M15 3.002H1a1 1 0 0 1 0-2h14a1 1 0 0 1 0 2Zm0 6H1a1 1 0 0 1 0-2h14a1 1 0 0 1 0 2Zm-14 6h14a1 1 0 0 0 0-2H1a1 1 0 0 0 0 2Z"/></svg>
Copy link
Member

Choose a reason for hiding this comment

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

Icon is not centered in the viewbox

@drakonux
Copy link
Member

Let me review all your comments, @matuzalemsteles. It is a huge task, and without Emi, I'll need to take my time.

@matuzalemsteles
Copy link
Member

@drakonux no problem, don't worry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants