allow top bar action buttons to be links and make home one (#417)
parent
b035969402
commit
063a8e4767
|
@ -9,3 +9,4 @@ website_build
|
|||
deno.lock
|
||||
fly.toml
|
||||
env.sh
|
||||
test_space
|
|
@ -13,6 +13,7 @@ export type ActionButton = {
|
|||
icon: FunctionalComponent<FeatherProps>;
|
||||
description: string;
|
||||
callback: () => void;
|
||||
href?: string;
|
||||
};
|
||||
|
||||
export function TopBar({
|
||||
|
@ -118,9 +119,11 @@ export function TopBar({
|
|||
</div>
|
||||
)}
|
||||
<div className="sb-actions">
|
||||
{actionButtons.map((actionButton) => (
|
||||
{actionButtons.map((actionButton) => {
|
||||
const button =
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
actionButton.callback();
|
||||
e.stopPropagation();
|
||||
}}
|
||||
|
@ -128,7 +131,9 @@ export function TopBar({
|
|||
>
|
||||
<actionButton.icon size={18} />
|
||||
</button>
|
||||
))}
|
||||
|
||||
return actionButton.href !== undefined ? (<a href={actionButton.href}>{button}</a>) : button;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1405,6 +1405,7 @@ export class Editor {
|
|||
callback: () => {
|
||||
editor.navigate("");
|
||||
},
|
||||
href: "",
|
||||
},
|
||||
{
|
||||
icon: BookIcon,
|
||||
|
|
Loading…
Reference in New Issue