Skip to content

Commit

Permalink
Added keyboard types
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszmigas committed Mar 3, 2024
1 parent f97442f commit a551cfc
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppMenuBar } from "@/components/appMenuBar";
import { AppHeaderBar } from "@/components/appHeaderBar";
import { AppStatusBar } from "@/components/appStatusBar";
import { AppContent } from "@/components/appContent";
import { useSyncTheme } from "./hooks/useSyncTheme";
Expand All @@ -7,7 +7,7 @@ export const App = () => {
useSyncTheme();
return (
<div className="w-full h-full flex flex-col">
<AppMenuBar></AppMenuBar>
<AppHeaderBar></AppHeaderBar>
<AppContent></AppContent>
<AppStatusBar></AppStatusBar>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "@/components/ui/menubar";
import { ModeToggle } from "./themeToggle";

export const AppMenuBar = () => {
export const AppHeaderBar = () => {
return (
<div className="border-b flex flex-row justify-between items-center px-2">
<Menubar className="border-none">
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/menu-bar/definitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//todo
1 change: 1 addition & 0 deletions apps/web/src/utils/key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Key = "W";
6 changes: 6 additions & 0 deletions apps/web/src/utils/keyBinding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { KeyGesture } from "./keyGesture";

export type KeyBinding = {
keyGesture: KeyGesture;
command: string;
};
10 changes: 10 additions & 0 deletions apps/web/src/utils/keyGesture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Key } from "./key";

export type KeyGesture = {
key: Key;
ctrl: boolean;
shift: boolean;
meta: boolean;
alt: boolean;
};

30 changes: 30 additions & 0 deletions apps/web/src/utils/menuItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { KeyGesture } from "@/utils/keyGesture";

type MenuItemAction =
| {
onClick: () => void;
}
| {
commandId: string;
}
| {
role: string;
};

export type MenuItem =
| {
type: "parent";
label: string;
items: MenuItem[];
}
| {
type: "child";
action: MenuItemAction;
label: string;
disabled?: boolean;
KeyGesture?: KeyGesture;
}
| {
type: "separator";
};

0 comments on commit a551cfc

Please sign in to comment.