feat: add Keybind component for displaying keyboard shortcuts
This commit is contained in:
18
packages/ui/src/components/keybind.css
Normal file
18
packages/ui/src/components/keybind.css
Normal file
@@ -0,0 +1,18 @@
|
||||
[data-component="keybind"] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
height: 20px;
|
||||
padding: 0 8px;
|
||||
border-radius: 2px;
|
||||
background: var(--surface-base);
|
||||
box-shadow: var(--shadow-xxs-border);
|
||||
|
||||
/* text-12-medium */
|
||||
font-family: var(--font-family-sans);
|
||||
font-size: 12px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: 1;
|
||||
color: var(--text-weak);
|
||||
}
|
||||
20
packages/ui/src/components/keybind.tsx
Normal file
20
packages/ui/src/components/keybind.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { ComponentProps, ParentProps } from "solid-js"
|
||||
|
||||
export interface KeybindProps extends ParentProps {
|
||||
class?: string
|
||||
classList?: ComponentProps<"span">["classList"]
|
||||
}
|
||||
|
||||
export function Keybind(props: KeybindProps) {
|
||||
return (
|
||||
<span
|
||||
data-component="keybind"
|
||||
classList={{
|
||||
...(props.classList ?? {}),
|
||||
[props.class ?? ""]: !!props.class,
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
@import "../components/icon.css" layer(components);
|
||||
@import "../components/icon-button.css" layer(components);
|
||||
@import "../components/image-preview.css" layer(components);
|
||||
@import "../components/keybind.css" layer(components);
|
||||
@import "../components/text-field.css" layer(components);
|
||||
@import "../components/inline-input.css" layer(components);
|
||||
@import "../components/list.css" layer(components);
|
||||
|
||||
Reference in New Issue
Block a user