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: QrCode Component #1731

Merged
merged 16 commits into from
Dec 16, 2024
Merged

Feat: QrCode Component #1731

merged 16 commits into from
Dec 16, 2024

Conversation

brendan-defi
Copy link
Contributor

@brendan-defi brendan-defi commented Dec 13, 2024

What changed? Why?

  • Implemented components and utilities for creating beautiful QR codes

Default
image

Base
image

Cyberpunk
image

Hacker
image

Notes to reviewers

How has it been tested?
locally, and with test coverage

Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 0:31am
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 0:31am
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2024 0:31am

startColor: '#0052ff',
endColor: '#b2cbff',
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to make all of these pull from theme colors so when a user customizes a theme (or adds their own) the qr code adapts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed - we should avoid having to update this file when adding new themes.

Has the QR component been tested with custom themes? Curious if it's updating as expected.

gradientType?: 'radial' | 'linear';
};

export function QrCodeSvg({
Copy link
Contributor

Choose a reason for hiding this comment

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

may want to wrap in memo

if (React.isValidElement(logo)) {
logo = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
ReactDOMServer.renderToString(logo),
)}`;
Copy link
Contributor

@alessey alessey Dec 13, 2024

Choose a reason for hiding this comment

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

can't we just display the "logo"? what happens if an <img/> tag is passed in or a text node?

Comment on lines +25 to +36
value: string;
size?: number;
backgroundColor?: string;
logo?: React.ReactNode;
logoSize?: number;
logoBackgroundColor?: string;
logoMargin?: number;
logoBorderRadius?: number;
quietZone?: number;
quietZoneBorderRadius?: number;
ecl?: 'L' | 'M' | 'Q' | 'H';
gradientType?: 'radial' | 'linear';
Copy link
Contributor

@cpcramer cpcramer Dec 13, 2024

Choose a reason for hiding this comment

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

I know many of these are optional but curious if we even need all of these props - do we want this low level of customization for a QR code? I imagine that a few of these params will always stay the same and therefore we can just default in the func and cleanup the amount of props used

fillRule="evenodd"
clipRule="evenodd"
d="M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z"
fill="white"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this adapt to theming?

Copy link
Contributor

@alessey alessey left a comment

Choose a reason for hiding this comment

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

approved with themes/dark mode as fast follows

@brendan-defi brendan-defi merged commit 185905e into main Dec 16, 2024
16 checks passed
@brendan-defi brendan-defi deleted the feat/qr-code branch December 16, 2024 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants