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

fix: QRCode style.padding should work #45815

Merged
merged 6 commits into from Nov 13, 2023
Merged

fix: QRCode style.padding should work #45815

merged 6 commits into from Nov 13, 2023

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Nov 12, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

close #45801

💡 Background and solution

这个修改后,将可以通过

<QRCode style={{ padding: 0 }} />

或者

.ant-qrcode {
  padding: 0;
}

修改默认的 padding。

📝 Changelog

Language Changelog
🇺🇸 English Fix QRCode style.padding is not working.
🇨🇳 Chinese 修复 QRCode 设置 style.padding 时无效的问题。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at 3070be8

This pull request fixes a bug in the QRCode component that ignored the style.padding prop. It adds a helper function to handle different padding formats and a test case to verify the component's behavior.

🔍 Walkthrough

🤖 Generated by Copilot at 3070be8

  • Fix a bug where QRCode component did not respect the style.padding prop (link, link)
    • Use a helper function getQrCodePadding to calculate the padding value from different types and formats of the prop in components/qr-code/index.tsx (link)
    • Add a test case for the style.padding prop in components/qr-code/__tests__/index.test.tsx to check the width and height of the canvas element with different values of padding (link)

Copy link

stackblitz bot commented Nov 12, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Nov 12, 2023

Preview Is ready

Copy link
Contributor

github-actions bot commented Nov 12, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 400.89 KB (+16 B 🔺)
./dist/antd-with-locales.min.js 460.23 KB (+15 B 🔺)

Copy link

codesandbox-ci bot commented Nov 12, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a75e92c:

Sandbox Source
antd reproduction template (forked) Configuration

Copy link

argos-ci bot commented Nov 12, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Nov 13, 2023, 10:09 AM

Copy link

codecov bot commented Nov 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (aa348dc) 100.00% compared to head (a75e92c) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #45815   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          700       700           
  Lines        11833     11833           
  Branches      3155      3155           
=========================================
  Hits         11833     11833           
Files Coverage Δ
components/qr-code/index.tsx 100.00% <ø> (ø)
components/qr-code/style/index.ts 100.00% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@afc163 afc163 marked this pull request as draft November 13, 2023 03:01
@afc163 afc163 force-pushed the fix/qrcode-padding branch 2 times, most recently from fbdb5f2 to db96681 Compare November 13, 2023 07:50
@afc163 afc163 marked this pull request as ready for review November 13, 2023 07:51
@afc163 afc163 force-pushed the fix/qrcode-padding branch 2 times, most recently from e0f4686 to 8412209 Compare November 13, 2023 08:06
@afc163 afc163 merged commit cb8f709 into master Nov 13, 2023
92 checks passed
@afc163 afc163 deleted the fix/qrcode-padding branch November 13, 2023 10:35
@PeachScript PeachScript mentioned this pull request Nov 17, 2023
20 tasks
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.

QRCode组件希望可以支持不加padding
5 participants