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

refactor(theme-classic): split CodeBlock #7175

Merged
merged 8 commits into from
Apr 15, 2022
Merged

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Apr 14, 2022

Motivation

Preliminary refactor before extracting new theme components meant to be swizzled

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

Preview tests should be exactly as before

@slorber slorber added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Apr 14, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 14, 2022
@netlify
Copy link

netlify bot commented Apr 14, 2022

[V2]

Name Link
🔨 Latest commit f82ea31
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62592d67d686be0008d4e47a
😎 Deploy Preview https://deploy-preview-7175--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Apr 14, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 62
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7175--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Apr 14, 2022

Size Change: 0 B

Total Size: 799 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 50 kB
website/build/assets/css/styles.********.css 106 kB
website/build/assets/js/main.********.js 604 kB
website/build/index.html 38.6 kB

compressed-size-action

Comment on lines 142 to 145
<CodeBlockContainer
as="pre"
tabIndex={0}
className={clsx(styles.codeBlockStandalone, 'thin-scrollbar', className)}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

After this refactor I realized the ReactElement version doesn't accept title. I tried a bit but because it's inside a pre the font is different. Just a note that we may want to support that in the future.

@Josh-Cena Josh-Cena changed the title refactor: split CodeBlock refactor(theme-classic): split CodeBlock Apr 15, 2022
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Result looks the same

@Josh-Cena Josh-Cena merged commit 5273a53 into main Apr 15, 2022
@Josh-Cena Josh-Cena deleted the slorber/refactor-code-block branch April 15, 2022 09:58
@slorber
Copy link
Collaborator Author

slorber commented Apr 20, 2022

Thanks 👍

Little swizzle issue:

CleanShot 2022-04-20 at 12 07 47@2x

We can't swizzle the whole CodeBlock/Content, and styles.module.css will never be copied when swizzling Element/String (afaik it only copies CSS files with exact same name as the copied component)

Not sure what's the best way to improve refactor to handle that

@Josh-Cena
Copy link
Collaborator

We can't swizzle the whole CodeBlock/Content,

We should definitely allow that. I also realized we can't swizzle one of CodeBlock/Content/{Element,String} without also ejecting the CSS file because CSS is imported with relative paths. Maybe they should always be swizzled together since they seem so tightly coupled anyways...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants