-
Notifications
You must be signed in to change notification settings - Fork 464
Replace Kbd with custom SearchKbd component #2501
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
Conversation
✅ Deploy Preview for hyprnote-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| function SearchKbd({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <kbd | ||
| className={cn([ | ||
| "pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded px-1 font-mono text-xs font-medium", | ||
| "border border-neutral-300", | ||
| "bg-linear-to-b from-white to-neutral-100", | ||
| "text-neutral-400", | ||
| "shadow-[0_1px_0_0_rgba(0,0,0,0.1),inset_0_1px_0_0_rgba(255,255,255,0.8)]", | ||
| ])} | ||
| > | ||
| {children} | ||
| </kbd> | ||
| ); | ||
| } |
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.
The SearchKbd component has two issues:
- It uses
bg-linear-to-b, which is an invalid Tailwind class (should bebg-gradient-to-b), causing the background gradient to fail. - It does not accept a
classNameprop, preventing the application of responsive utility classes (e.g.,hidden sm:inline-flex) that were present in the original code. This causes the keyboard shortcut to be visible on mobile devices where it should be hidden.
Update the component to fix the class name and accept className props, then update the usages to restore the responsive classes.
| function SearchKbd({ children }: { children: React.ReactNode }) { | |
| return ( | |
| <kbd | |
| className={cn([ | |
| "pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded px-1 font-mono text-xs font-medium", | |
| "border border-neutral-300", | |
| "bg-linear-to-b from-white to-neutral-100", | |
| "text-neutral-400", | |
| "shadow-[0_1px_0_0_rgba(0,0,0,0.1),inset_0_1px_0_0_rgba(255,255,255,0.8)]", | |
| ])} | |
| > | |
| {children} | |
| </kbd> | |
| ); | |
| } | |
| function SearchKbd({ children, className }: { children: React.ReactNode; className?: string }) { | |
| return ( | |
| <kbd | |
| className={cn([ | |
| "pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded px-1 font-mono text-xs font-medium", | |
| "border border-neutral-300", | |
| "bg-gradient-to-b from-white to-neutral-100", | |
| "text-neutral-400", | |
| "shadow-[0_1px_0_0_rgba(0,0,0,0.1),inset_0_1px_0_0_rgba(255,255,255,0.8)]", | |
| className, | |
| ])} | |
| > | |
| {children} | |
| </kbd> | |
| ); | |
| } | |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
No description provided.