feat(sra): Add QR Modal#322
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| }, | ||
| "dependencies": { | ||
| "clsx": "^2.1.1", | ||
| "qrcode": "^1.5.4", |
There was a problem hiding this comment.
Maybe we could use https://www.npmjs.com/package/uqr? It's more lightweight for what we're trying to do.
179f991 to
cf04c8c
Compare
cf04c8c to
d10bcf1
Compare
d10bcf1 to
e7f7f94
Compare
e7f7f94 to
252b392
Compare
252b392 to
ec6950c
Compare
ec6950c to
1c0851b
Compare
1c0851b to
45a13b3
Compare
45a13b3 to
3c63b2d
Compare
8f7972b to
ff9b411
Compare
ff9b411 to
cfc4ad5
Compare
73bd63d to
4758aea
Compare
| @@ -0,0 +1,77 @@ | |||
| import * as Dialog from '@radix-ui/react-dialog' | |||
There was a problem hiding this comment.
Nice looking good! A few changes I'd make here to make it even smoother:
export const Sheet = Dialog.Root
export const SheetClose = Dialog.Close
export function SheetTitle({ className, ...props }: SheetTitleProps) {
return <Dialog.Title className={cn('zd:sr-only', className)} {...props} />
}Rename this:
SheetShell -> SheetContent
And remove this line:
<Dialog.Root open={open} onOpenChange={onOpenChange}>With this alone we can get rid of all the props, except for children and className. The consumer passes open state to Sheet itself. The consumer looks something like this:
<Sheet open={isOpen}>
<SheetContent>
<SheetTitle>{title}</SheetTitle >
{content}
// If need a close button
<SheetClose asChild>
<Button text="Cancel" />
</SheetClose>
<SheetContent />
</Sheet>So I'd drop Shell from the name IMO, was my initial suggestion but I think Sheet is enough.
# Conflicts: # packages/react-ui/package.json # packages/react-ui/src/index.ts # pnpm-lock.yaml
There was a problem hiding this comment.
I'd just make the name future-proof and call it a Sheet. So for example, in the future we can do side: 'bottom' | 'right' without introducing breaking changes.
Also we call it BottomSheet but export components like SheetClose, SheetTitle. So there's already an inconsistency we could resolve by Sheet only.
There was a problem hiding this comment.
I'd just keep it in the SRA package. We can't reuse it anywhere else - its content/layout is only relevant to SRA.
Maybe we will be able to do something with it in the future. But going forward when it comes to non-primitive components, even if we have duplicates for a bit, it's much better than early abstractions.
also nit: probs could name it QrSheet since we make a distinction between the two; and it's using Sheet
Closes FS-2282