Added "home" button and tooltips

pull/3/head
Zef Hemel 2022-07-04 11:38:16 +02:00
parent f29f9315a1
commit 5c6a49d62a
4 changed files with 24 additions and 30 deletions

View File

@ -30,6 +30,8 @@ export function PageNavigator({
if (currentPage && currentPage.includes("/")) { if (currentPage && currentPage.includes("/")) {
const pieces = currentPage.split("/"); const pieces = currentPage.split("/");
completePrefix = pieces.slice(0, pieces.length - 1).join("/") + "/"; completePrefix = pieces.slice(0, pieces.length - 1).join("/") + "/";
} else if (currentPage && currentPage.includes(" ")) {
completePrefix = currentPage.split(" ")[0] + " ";
} }
return ( return (
<FilterList <FilterList

View File

@ -1,4 +1,4 @@
import { faRunning } from "@fortawesome/free-solid-svg-icons"; import { faRunning, faHome } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Notification } from "../types"; import { Notification } from "../types";
@ -14,6 +14,7 @@ export function TopBar({
unsavedChanges, unsavedChanges,
notifications, notifications,
onClick, onClick,
onHomeClick,
onActionClick, onActionClick,
lhs, lhs,
rhs, rhs,
@ -22,6 +23,7 @@ export function TopBar({
unsavedChanges: boolean; unsavedChanges: boolean;
notifications: Notification[]; notifications: Notification[];
onClick: () => void; onClick: () => void;
onHomeClick: () => void;
onActionClick: () => void; onActionClick: () => void;
lhs?: React.ReactNode; lhs?: React.ReactNode;
rhs?: React.ReactNode; rhs?: React.ReactNode;
@ -46,10 +48,19 @@ export function TopBar({
<div className="actions"> <div className="actions">
<button <button
onClick={(e) => { onClick={(e) => {
// setMenuExpanded(!menuExpanded); onHomeClick();
e.stopPropagation();
}}
title="Navigate to the 'index' page"
>
<FontAwesomeIcon icon={faHome} />
</button>
<button
onClick={(e) => {
onActionClick(); onActionClick();
e.stopPropagation(); e.stopPropagation();
}} }}
title="Open the command palette"
> >
<FontAwesomeIcon icon={faRunning} /> <FontAwesomeIcon icon={faRunning} />
</button> </button>

View File

@ -656,6 +656,9 @@ export class Editor {
onClick={() => { onClick={() => {
dispatch({ type: "start-navigate" }); dispatch({ type: "start-navigate" });
}} }}
onHomeClick={() => {
editor.navigate("index");
}}
onActionClick={() => { onActionClick={() => {
dispatch({ type: "show-palette" }); dispatch({ type: "show-palette" });
}} }}

View File

@ -112,35 +112,13 @@ body {
} }
.actions { .actions {
text-align: right; text-align: right;
width: 40px;
ul { button {
list-style: none; border: 1px solid #7897d0;
margin-left: 0; border-radius: 3px;
padding-left: 0; margin: 3px;
margin-top: 0; padding: 5px;
list-style: none; background-color: #e6e6e6;
background: #fff;
border: #000 1px solid;
text-align: left;
a {
padding: 3px;
font-family: var(--ui-font);
font-size: 50%;
text-decoration: none;
color: #000;
}
li {
padding-left: 10px;
padding-right: 10px;
padding-bottom: 5px;
}
li:hover {
background-color: #4d8dff12;
}
} }
} }
} }