-
Notifications
You must be signed in to change notification settings - Fork 246
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
Feat: QrCode Component #1731
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
startColor: '#0052ff', | ||
endColor: '#b2cbff', | ||
}, | ||
}; |
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.
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?
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.
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({ |
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.
may want to wrap in memo
if (React.isValidElement(logo)) { | ||
logo = `data:image/svg+xml;charset=utf-8,${encodeURIComponent( | ||
ReactDOMServer.renderToString(logo), | ||
)}`; |
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.
can't we just display the "logo"? what happens if an <img/>
tag is passed in or a text node?
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'; |
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.
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" |
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.
Should this adapt to theming?
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.
approved with themes/dark mode as fast follows
What changed? Why?
Default
![image](https://private-user-images.githubusercontent.com/39347156/395487458-1a1c46d8-6372-4d41-a128-f48bf860edc4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTE2MjQsIm5iZiI6MTczOTI1MTMyNCwicGF0aCI6Ii8zOTM0NzE1Ni8zOTU0ODc0NTgtMWExYzQ2ZDgtNjM3Mi00ZDQxLWExMjgtZjQ4YmY4NjBlZGM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDA1MjIwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwZDMyNmNjMTAxNTIzNGZmNjEwNTI0ZDlkMTU2YzhkNWZjYWZlMzYxM2M2MTU5ZGRlZmE5MzliYTYyMTAzNmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.98ssSEaEKPcsKfPM08gPsYKs0Y2TfiezofwSpcOc02E)
Base
![image](https://private-user-images.githubusercontent.com/39347156/395487556-0fb0a3f6-6462-413a-9910-eac21199853e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTE2MjQsIm5iZiI6MTczOTI1MTMyNCwicGF0aCI6Ii8zOTM0NzE1Ni8zOTU0ODc1NTYtMGZiMGEzZjYtNjQ2Mi00MTNhLTk5MTAtZWFjMjExOTk4NTNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDA1MjIwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYwMTE1MDlmN2Q2ZWE1NGExNGMwMjNlOGRmYWMxNDBmYTI2ZjY5YWEzNDYwMGY3OThhNDM1NzAwOTRiYTg4ODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.z2k9hZfk2j4eCOF5Y7bDPSJLrbAF01e_WBUaDoGO_v4)
Cyberpunk
![image](https://private-user-images.githubusercontent.com/39347156/395487632-84597a50-b51e-41d5-a249-fab26b7322e1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTE2MjQsIm5iZiI6MTczOTI1MTMyNCwicGF0aCI6Ii8zOTM0NzE1Ni8zOTU0ODc2MzItODQ1OTdhNTAtYjUxZS00MWQ1LWEyNDktZmFiMjZiNzMyMmUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDA1MjIwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY2OTNmN2Y0ZDQwMmViMmJiMDlhZDIwMzEwZTg4ZDZmNzE0NzI3OWVjYTZhMDhhZWY3YjVkM2UwYzJhNzA2NTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.a8fZvilUgOSmWIC2zn65XPRBqaUyHQO3gE-4uGciZug)
Hacker
![image](https://private-user-images.githubusercontent.com/39347156/395487703-3311f3d9-abae-4c22-ba93-09f5450644e7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTE2MjQsIm5iZiI6MTczOTI1MTMyNCwicGF0aCI6Ii8zOTM0NzE1Ni8zOTU0ODc3MDMtMzMxMWYzZDktYWJhZS00YzIyLWJhOTMtMDlmNTQ1MDY0NGU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDA1MjIwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc1ZmQzNzcwYWY0NGRmNzMxYTFkMzBlZDNjN2U0MGE5ODM4YTMwOTFlZWQ5YzRiNDc3NDA5YjgzNGI5MzcyOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.RtZvJoYzRBMarEGbhbu-j_406I8NF47Z_6CN2ZjanrU)
Notes to reviewers
How has it been tested?
locally, and with test coverage