fix(v2): refactor icons in theme-classic, fix swizzle issue#3854
fix(v2): refactor icons in theme-classic, fix swizzle issue#3854slorber merged 3 commits intofacebook:masterfrom
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
|
slorber
left a comment
There was a problem hiding this comment.
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.
"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-classicand introduces three new and swizzable icon components:IconArrow,IconEdit,IconMenu.I have tried to add define them in the
iconsfolder 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
DocPageandDocSidebar.Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Local run of V2 Docusuaurs website with swizzled
DocSidebarcomponent.Related PRs