make titlebar logo a home button

This commit is contained in:
b1ek 2023-08-23 22:33:13 +10:00
parent 5cb84d37bd
commit 01e5016495
Signed by: blek
GPG Key ID: 14546221E3595D0C
3 changed files with 34 additions and 5 deletions

View File

@ -4,11 +4,17 @@ export interface RouteState {
path: string path: string
} }
export default configureStore({ const store = configureStore({
reducer: { reducer: {
path: (state = '/load', action) => { path: (state = '/load', action) => {
if (action.type != 'setPath') return state; if (action.type != 'setPath') return state;
return action.path ?? state; return action.path ?? state;
} }
}, },
}) });
export default store;
export function route(path) {
store.dispatch({ type: 'setPath', path });
}

View File

@ -10,6 +10,7 @@
import { appWindow } from '@tauri-apps/api/window' import { appWindow } from '@tauri-apps/api/window'
import Blek from '../../shared/blek.svelte'; import Blek from '../../shared/blek.svelte';
import { route } from '../../store/RouteStore';
</script> </script>
<div class={style.titlebar}> <div class={style.titlebar}>
@ -19,8 +20,14 @@
<tbody> <tbody>
<tr> <tr>
<td data-tauri-drag-region class={style.name}> <td data-tauri-drag-region class={style.name}>
<Blek height='14px' />
nox <!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-missing-attribute -->
<a class={style.home_btn} on:click={() => {route('/')}}>
<Blek height='14px' />
nox
</a>
</td> </td>
<td align='right' width='130px' class={style.btns}> <td align='right' width='130px' class={style.btns}>
<table> <table>

View File

@ -37,8 +37,24 @@ $corners: 16px;
cursor: default; cursor: default;
color: #b0b0b0; color: #b0b0b0;
font-size: 12pt; font-size: 12pt;
padding-left: 12px;
width: 100%; width: 100%;
.home_btn {
color: #b0b0b0;
height: fit-content;
width: fit-content;
padding: 6px 12px;
padding-right: 16px;
display: block;
cursor: pointer;
text-decoration: none;
transition: 250ms ease;
&:hover {
background: #0003;
}
}
} }
.btns { .btns {