mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
chore: Enhancement + New Feature (#185)
* wip * wip page * chore: style * wip pages * wip pages * chore: toggle * chore: link * feat: topic search * chore: page section * refactor: apply tailwind class ordering * fix: handle loggedIn user for guest route * feat: folder & image schema * chore: move utils to shared * refactor: tailwind class ordering * feat: img ext for editor * refactor: remove qa * fix: tanstack start * fix: wrong import * chore: use toast * chore: schema
This commit is contained in:
55
web/shared/editor/components/ui/shortcut.tsx
Normal file
55
web/shared/editor/components/ui/shortcut.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { getShortcutKey } from "@shared/utils"
|
||||
|
||||
export interface ShortcutKeyWrapperProps
|
||||
extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
ariaLabel: string
|
||||
}
|
||||
|
||||
const ShortcutKeyWrapper = React.forwardRef<
|
||||
HTMLSpanElement,
|
||||
ShortcutKeyWrapperProps
|
||||
>(({ className, ariaLabel, children, ...props }, ref) => {
|
||||
return (
|
||||
<span
|
||||
aria-label={ariaLabel}
|
||||
className={cn("inline-flex items-center gap-0.5", className)}
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
})
|
||||
|
||||
ShortcutKeyWrapper.displayName = "ShortcutKeyWrapper"
|
||||
|
||||
export interface ShortcutKeyProps
|
||||
extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
shortcut: string
|
||||
}
|
||||
|
||||
const ShortcutKey = React.forwardRef<HTMLSpanElement, ShortcutKeyProps>(
|
||||
({ className, shortcut, ...props }, ref) => {
|
||||
return (
|
||||
<kbd
|
||||
className={cn(
|
||||
"inline-block min-w-2.5 text-center align-baseline font-sans text-xs font-medium capitalize text-[rgb(156,157,160)]",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
{getShortcutKey(shortcut).symbol}
|
||||
</kbd>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
ShortcutKey.displayName = "ShortcutKey"
|
||||
|
||||
export const Shortcut = {
|
||||
Wrapper: ShortcutKeyWrapper,
|
||||
Key: ShortcutKey,
|
||||
}
|
||||
Reference in New Issue
Block a user