-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(v2): refactor icons in theme-classic, fix swizzle issue #3854
fix(v2): refactor icons in theme-classic, fix swizzle issue #3854
Conversation
Deploy preview for docusaurus-2 ready! Built without sensitive environment variables with commit 6d7e32f |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-3854--docusaurus-2.netlify.app/classic/ |
Size Change: +22 B (0%) Total Size: 157 kB ℹ️ View Unchanged
|
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.
thanks, that's a helpful refactor that we'd probably have to do to create the theme gallery anyway 👍
just I'd rather not hardcode a margin inside the SVG directly
style={{ | ||
marginRight: '0.3em', | ||
verticalAlign: 'sub', | ||
}} |
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.
"external" styles should rather be passed as props and keep in the parent component.
Some refs:
https://visly.app/blogposts/layout-isolated-components
https://mxstbr.com/thoughts/margin
It was how the inline SVG code looked like before refactor. I will extract the inilne styles in the next commit. |
it was fine before because the svg was inlined, if we make a real comp we should only put "internal styles" in it, so that the component can be used safely in multiple different contexts. |
Thanks Actually I meant the styles like margin should not be at all in the IconEdit comp, but in the comps using them (ie But in this case, it would create some duplication as the comp is used in the same way from 2 places, so let's merge and see 🤷♂️ |
Motivation
Fixes #3830
This PR refactor all SVG usages in the
theme-classic
and introduces three new and swizzable icon components:IconArrow
,IconEdit
,IconMenu
.I have tried to add define them in the
icons
folder but there were some wired import issues on build, maybe some one will be able to improve the directory structure in the future.This refactor also fixes the swizzle problem, which occurs currently for
DocPage
andDocSidebar
.Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Local run of V2 Docusuaurs website with swizzled
DocSidebar
component.Related PRs