Skip to content

Commit 7674378

Browse files
committed
misc
1 parent 00d1706 commit 7674378

File tree

3 files changed

+58
-38
lines changed

3 files changed

+58
-38
lines changed

apps/www/src/components/buttons/AddBuildingSheet.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function AddBuildingSheet({ propertyId }) {
8484
return (
8585
<Sheet>
8686
<SheetTrigger asChild>
87-
<Button variant="outline">Add New Building</Button>
87+
<Button variant="outline">Legg til ny byggning</Button>
8888
</SheetTrigger>
8989
<SheetContent>
9090
<SheetHeader>
+50-30
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
1-
"use client"
1+
"use client";
22

3-
import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@dingify/ui/components/command"
4-
import Link from "next/link"
5-
import { useEffect, useState } from "react"
3+
import { useEffect, useState } from "react";
4+
import Link from "next/link";
5+
6+
import {
7+
CommandDialog,
8+
CommandEmpty,
9+
CommandGroup,
10+
CommandInput,
11+
CommandItem,
12+
CommandList,
13+
} from "@dingify/ui/components/command";
614

715
export default function GlobalSearch() {
8-
const [open, setOpen] = useState(false)
9-
10-
useEffect(() => {
11-
const down = (e: KeyboardEvent) => {
12-
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
13-
e.preventDefault()
14-
setOpen((open) => !open)
15-
}
16+
const [open, setOpen] = useState(false);
17+
18+
useEffect(() => {
19+
const down = (e: KeyboardEvent) => {
20+
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
21+
e.preventDefault();
22+
setOpen((open) => !open);
1623
}
17-
document.addEventListener("keydown", down)
18-
return () => document.removeEventListener("keydown", down)
19-
}, [])
20-
21-
return (
22-
<CommandDialog open={open} onOpenChange={setOpen}>
23-
<CommandInput placeholder="Type a command or search..." />
24-
<CommandList>
25-
<CommandEmpty>No results found.</CommandEmpty>
26-
<CommandGroup heading="Suggestions">
27-
<CommandItem><Link className="w-full" href="/property">Eiendommer</Link></CommandItem>
28-
<CommandItem><Link className="w-full" href="/tenant">Leietakere</Link></CommandItem>
29-
<CommandItem><Link className="w-full" href="/analytics">Analyser</Link></CommandItem>
30-
</CommandGroup>
31-
</CommandList>
32-
</CommandDialog>
33-
)
34-
}
24+
};
25+
document.addEventListener("keydown", down);
26+
return () => document.removeEventListener("keydown", down);
27+
}, []);
28+
29+
return (
30+
<CommandDialog open={open} onOpenChange={setOpen}>
31+
<CommandInput placeholder="Skriv hva du søker etter..." />
32+
<CommandList>
33+
<CommandEmpty>No results found.</CommandEmpty>
34+
<CommandGroup heading="Suggestions">
35+
<CommandItem>
36+
<Link className="w-full" href="/property">
37+
Eiendommer
38+
</Link>
39+
</CommandItem>
40+
<CommandItem>
41+
<Link className="w-full" href="/tenant">
42+
Leietakere
43+
</Link>
44+
</CommandItem>
45+
<CommandItem>
46+
<Link className="w-full" href="/analytics">
47+
Analyser
48+
</Link>
49+
</CommandItem>
50+
</CommandGroup>
51+
</CommandList>
52+
</CommandDialog>
53+
);
54+
}

packages/ui/src/components/command.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Command = React.forwardRef<
1616
ref={ref}
1717
className={cn(
1818
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19-
className
19+
className,
2020
)}
2121
{...props}
2222
/>
@@ -28,7 +28,7 @@ type CommandDialogProps = DialogProps;
2828
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
2929
return (
3030
<Dialog {...props}>
31-
<DialogContent className="overflow-hidden p-0 shadow-2xl z-[9999]">
31+
<DialogContent className="z-[9999] overflow-hidden p-0 shadow-2xl">
3232
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
3333
{children}
3434
</Command>
@@ -47,7 +47,7 @@ const CommandInput = React.forwardRef<
4747
ref={ref}
4848
className={cn(
4949
"placeholder:text-foreground-muted flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
50-
className
50+
className,
5151
)}
5252
{...props}
5353
/>
@@ -90,7 +90,7 @@ const CommandGroup = React.forwardRef<
9090
ref={ref}
9191
className={cn(
9292
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
93-
className
93+
className,
9494
)}
9595
{...props}
9696
/>
@@ -117,8 +117,8 @@ const CommandItem = React.forwardRef<
117117
<CommandPrimitive.Item
118118
ref={ref}
119119
className={cn(
120-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
121-
className
120+
"relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
121+
className,
122122
)}
123123
{...props}
124124
/>
@@ -134,7 +134,7 @@ const CommandShortcut = ({
134134
<span
135135
className={cn(
136136
"ml-auto text-xs tracking-widest text-muted-foreground",
137-
className
137+
className,
138138
)}
139139
{...props}
140140
/>

0 commit comments

Comments
 (0)