Start adding UI

This commit is contained in:
Benjamin Bädorf 2022-12-28 20:59:58 +01:00
parent 520b3a6753
commit 27b7e3afec
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
7 changed files with 107 additions and 11 deletions

View file

@ -0,0 +1,38 @@
body {
margin: 0;
}
.ex-app {
display: flex;
width: 100vw;
min-height: 100vh;
justify-content: space-between;
align-items: stretch;
--nav-width: 60px;
--nav-expanded-width: 320px;
&--admin-nav {
z-index: 100;
position: fixed;
top: 0;
left: 0;
bottom: 0;
}
&--page {
flex-basis: 100%;
}
@media screen and (min-width: 1000px) {
--nav-width: var(--nav-expanded-width);
&--admin-nav {
position: unset;
width: unset;
flex-basis: var(--nav-width);
flex-grow: 0;
flex-shrink: 0;
}
}
}

View file

@ -1,10 +1,18 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { NuxtPage } from '#components'; import { NuxtPage } from '#components';
import './app.scss';
const AdminNav = defineAsyncComponent(() => import('~~/components/admin/Nav'));
export default defineComponent({ export default defineComponent({
setup() { setup() {
const { me } = useMe();
return () => ( return () => (
<NuxtPage /> <div class="ex-app">
{me.value ? <AdminNav class="ex-app--admin-nav" /> : null}
<NuxtPage class="ex-app--page" />
</div>
); );
}, },
}); });

View file

@ -1,10 +1,8 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { SbMode } from '@schlechtenburg/core'; import { SbButton, SbMode } from '@schlechtenburg/core';
export default defineComponent({ export default defineComponent({
async setup() { async setup() {
const { me } = useMe();
const { page } = usePage(); const { page } = usePage();
const { const {
@ -17,19 +15,19 @@ export default defineComponent({
return () => ( return () => (
<div class="ex-page-toolbar"> <div class="ex-page-toolbar">
{ mode.value === SbMode.View { mode.value === SbMode.View
? <button ? <SbButton
type="button" type="button"
onClick={() => edit(page.value?.attributes?.block!)} onClick={() => edit(page.value?.attributes?.block!)}
>Edit</button> >Edit</SbButton>
: <> : <>
<button <SbButton
type="button" type="button"
onClick={() => cancel()} onClick={() => cancel()}
>Cancel</button> >Cancel</SbButton>
<button <SbButton
type="button" type="button"
onClick={() => save()} onClick={() => save()}
>Save</button> >Save</SbButton>
</>} </>}
</div> </div>
); );

View file

@ -0,0 +1,3 @@
.ex-main-menu {
}

View file

@ -0,0 +1,12 @@
.ex-admin-nav {
background-color: white;
width: var(--nav-width);
&_expanded {
width: 80vw;
max-width: 300px;
}
@media screen and (min-width: 1000px) {
}
}

View file

@ -0,0 +1,35 @@
import { defineComponent } from 'vue';
import { NuxtLink } from '~~/.nuxt/components';
import './Nav.scss';
export default defineComponent({
setup() {
const expanded = useState(() => false);
const toggle = () => {
expanded.value != expanded.value;
};
const classes = computed(() => ({
'ex-admin-nav': true,
'ex-admin-nav_expanded': expanded.value,
}));
return () => (
<nav
class={classes.value}
>
<button
class="ex-admin-nav--toggle"
type="button"
onClick={() => toggle()}
>Toggle</button>
<ul class="ex-admin-nav--menu">
<li class="ex-admin-nav--menu-item">
<NuxtLink to="/">Logout</NuxtLink>
</li>
</ul>
</nav>
);
},
});

View file

@ -1,7 +1,9 @@
import { defineNuxtConfig } from 'nuxt/config'; import { defineNuxtConfig } from 'nuxt/config';
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: ['nuxt-graphql-client'], modules: [
'nuxt-graphql-client',
],
runtimeConfig: { runtimeConfig: {
public: { public: {