improve styling

This commit is contained in:
Philipp Kühn 2021-02-03 23:36:29 +01:00
parent 31ed0fb89b
commit 0759f6f8ab
4 changed files with 141 additions and 136 deletions

View File

@ -45,10 +45,6 @@
background-color: transparent; background-color: transparent;
} }
html {
scroll-behavior: smooth;
}
body { body {
font-family: 'Inter', sans-serif; font-family: 'Inter', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

View File

@ -1,63 +1,63 @@
<template> <template>
<div class="app"> <div class="app">
<div class="app__navigation"> <div class="app__navigation">
<g-link class="app__name" to="/"> <div class="app__top-bar">
<img src="~@/assets/images/logo.svg"> <g-link class="app__logo" to="/">
</g-link> <img src="~@/assets/images/logo.svg">
</g-link>
<span style="position: relative"> <div class="app__menu">
Search <span class="app__menu-item">
<div class="app__search-docsearch" /> Search
</span> <div class="app__search-docsearch" />
<g-link to="/overview/installation"> </span>
Documentation
</g-link>
<g-link to="https://github.com/ueberdosis/tiptap-next">
GitHub
</g-link>
<button <portal-target name="desktop-menu" />
class="app__menu-icon" </div>
@click="menuIsVisible = true"
v-if="!menuIsVisible" <button
> class="app__menu-icon"
<icon name="menu" /> @click="menuIsVisible = true"
</button> v-if="!menuIsVisible"
<button >
class="app__close-icon" <icon name="menu" />
@click="menuIsVisible = false" </button>
v-if="menuIsVisible" <button
> class="app__close-icon"
<icon name="close" /> @click="menuIsVisible = false"
</button> v-if="menuIsVisible"
>
<icon name="close" />
</button>
</div>
<div class="app__mobile-menu" v-if="menuIsVisible">
<portal-target name="mobile-menu" />
<portal-target name="mobile-sidebar" />
</div>
</div> </div>
<div class="app__content"> <div class="app__content">
<div class="app__sidebar" v-if="showSidebar"> <div class="app__sidebar" v-if="showSidebar">
<portal-target name="desktop-nav" /> <portal-target name="desktop-sidebar" />
</div> </div>
<main class="app__main"> <main class="app__main">
<div class="app__top-bar"> <div class="app__inner">
<div class="app__inner app__top-bar-inner" /> <slot />
<div class="app__mobile-nav" v-if="menuIsVisible">
<portal-target name="mobile-nav" />
</div>
</div>
<main class="app__main">
<div class="app__inner">
<slot />
</div>
</main>
<div class="app__page-navigation" v-if="showSidebar">
<div class="app__inner">
<page-navigation />
</div>
</div> </div>
</main> </main>
<portal :to="portal"> <portal :to="menuPortal">
<nav class="app__sidebar-navigation"> <g-link class="app__menu-item" to="/overview/installation">
Documentation
</g-link>
<g-link class="app__menu-item" to="https://github.com/ueberdosis/tiptap-next">
GitHub
</g-link>
</portal>
<portal :to="sidebarPortal" v-if="showSidebar">
<nav class="app__sidebar-menu">
<div class="app__link-group" v-for="(linkGroup, i) in linkGroups" :key="i"> <div class="app__link-group" v-for="(linkGroup, i) in linkGroups" :key="i">
<div class="app__link-group-title"> <div class="app__link-group-title">
{{ linkGroup.title }} {{ linkGroup.title }}
@ -119,7 +119,6 @@ query {
<script> <script>
import linkGroups from '@/links.yaml' import linkGroups from '@/links.yaml'
import Icon from '@/components/Icon' import Icon from '@/components/Icon'
import PageNavigation from '@/components/PageNavigation'
// import GithubButton from 'vue-github-button' // import GithubButton from 'vue-github-button'
export default { export default {
@ -132,7 +131,6 @@ export default {
components: { components: {
Icon, Icon,
PageNavigation,
// GithubButton, // GithubButton,
}, },
@ -145,12 +143,20 @@ export default {
}, },
computed: { computed: {
portal() { menuPortal() {
if (this.windowWidth && this.windowWidth < 800) { if (this.windowWidth && this.windowWidth < 800) {
return 'mobile-nav' return 'mobile-menu'
} }
return 'desktop-nav' return 'desktop-menu'
},
sidebarPortal() {
if (this.windowWidth && this.windowWidth < 800) {
return 'mobile-sidebar'
}
return 'desktop-sidebar'
}, },
currentPath() { currentPath() {
@ -173,6 +179,10 @@ export default {
$route() { $route() {
this.menuIsVisible = false this.menuIsVisible = false
}, },
windowWidth() {
this.menuIsVisible = false
},
}, },
methods: { methods: {
@ -192,8 +202,10 @@ export default {
}, },
mounted() { mounted() {
this.initSearch()
this.handleResize() this.handleResize()
this.$nextTick(() => {
this.initSearch()
})
window.addEventListener('resize', this.handleResize) window.addEventListener('resize', this.handleResize)
}, },

View File

@ -2,19 +2,16 @@ $navHeight: 4.5rem;
$mobileBreakPoint: 600px; $mobileBreakPoint: 600px;
$menuBreakPoint: 800px; $menuBreakPoint: 800px;
.app { .app {
&__navigation { &__navigation {
position: fixed; position: fixed;
display: flex; display: flex;
flex-direction: column;
z-index: 2; z-index: 2;
top: 0; top: 0;
width: 100%; width: 100%;
height: $navHeight; max-height: 100vh;
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
border-bottom: 1px solid rgba($colorBlack, 0.1);
padding: 0 2rem;
&::after { &::after {
content: ''; content: '';
@ -31,29 +28,66 @@ $menuBreakPoint: 800px;
} }
} }
&__top-bar {
display: flex;
align-items: center;
flex: 0 0 auto;
height: $navHeight;
padding: 0 1rem;
@media (min-width: $menuBreakPoint) {
padding: 0 2rem;
}
}
&__menu {
display: flex;
align-items: center;
}
&__menu-item {
display: block;
overflow: hidden;
position: relative;
font-weight: 500;
@media (min-width: $menuBreakPoint) {
display: inline-flex;
margin-right: 1.5rem;
&:last-child {
margin-right: 0;
}
}
}
&__content { &__content {
display: flex; display: flex;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
&__name { &__logo {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
font-weight: 600; font-weight: 600;
color: $colorBlack; color: $colorBlack;
font-size: 1.5rem; font-size: 1.5rem;
margin-right: auto;
&::after { @media (min-width: 500px) {
content: '2.0 alpha'; &::after {
display: block; content: '2.0 alpha';
margin-left: 0.5rem; display: block;
font-size: 0.7rem; margin-left: 0.5rem;
letter-spacing: 0.05rem; font-size: 0.7rem;
text-transform: uppercase; font-weight: 700;
border-radius: 5px; letter-spacing: 0.05rem;
border: 1px solid $colorBlack; text-transform: uppercase;
padding: 0 0.4em; border-radius: 0.4rem;
border: 2px solid $colorBlack;
padding: 0 0.4em;
}
} }
} }
@ -105,45 +139,18 @@ $menuBreakPoint: 800px;
} }
} }
&__sidebar-menu {
margin-top: 1.5rem;
@media (min-width: $menuBreakPoint) {
margin-top: 0;
}
}
&__main { &__main {
flex: 1 1 auto; flex: 1 1 auto;
min-width: 0; min-width: 0;
} padding-top: $navHeight;
// &__top-bar {
// display: flex;
// flex-direction: column;
// padding: 1rem 0;
// position: sticky;
// z-index: 2;
// top: 0;
// backdrop-filter: blur(10px);
// max-height: 100vh;
// @media (min-width: $menuBreakPoint) {
// padding: 1.5rem 0;
// }
// &::after {
// content: '';
// z-index: -1;
// position: absolute;
// top: 0;
// left: 0;
// width: 100%;
// height: 100%;
// background-color: $colorWhite;
// opacity: 0.8;
// transform: translate3d(0,0,0);
// pointer-events: none;
// }
// }
&__top-bar-inner {
width: 100%;
display: flex;
align-items: center;
flex: 0 0 auto;
} }
&__menu-icon, &__menu-icon,
@ -153,7 +160,7 @@ $menuBreakPoint: 800px;
background: transparent; background: transparent;
border: 0; border: 0;
color: $colorText; color: $colorText;
margin-left: 1rem; margin-left: 1.5rem;
transition: color 0.2s $ease; transition: color 0.2s $ease;
&:hover { &:hover {
@ -165,16 +172,6 @@ $menuBreakPoint: 800px;
} }
} }
// &__inner {
// margin: 0 auto;
// max-width: 50rem;
// padding: 0 1rem;
// @media (min-width: $mobileBreakPoint) {
// padding: 0 2rem;
// }
// }
&__link-group { &__link-group {
margin-bottom: 1rem; margin-bottom: 1rem;
@ -201,7 +198,7 @@ $menuBreakPoint: 800px;
margin: 0.5rem 0; margin: 0.5rem 0;
} }
&__mobile-nav &__link-list &__link-list { &__mobile-menu &__link-list &__link-list {
display: block; display: block;
} }
@ -209,6 +206,14 @@ $menuBreakPoint: 800px;
display: block; display: block;
} }
&__mobile-menu &__menu-item {
margin-bottom: 1.5rem;
&:last-child {
margin-bottom: 0;
}
}
&__link { &__link {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -294,25 +299,12 @@ $menuBreakPoint: 800px;
} }
} }
&__mobile-nav &__link--with-children::after { &__mobile-menu &__link--with-children::after {
display: none; display: none;
} }
&__main { &__mobile-menu {
padding: 1rem 0; padding: 1rem 0 1rem 1rem;
@media (min-width: $mobileBreakPoint) {
padding: 2rem 0;
padding-top: $navHeight;
}
}
&__page-navigation {
border-top: 1px solid rgba($colorBlack, 0.1);
}
&__mobile-nav {
padding: 1rem;
flex: 1 1 auto; flex: 1 1 auto;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
@ -320,7 +312,7 @@ $menuBreakPoint: 800px;
overscroll-behavior: contain; overscroll-behavior: contain;
@media (min-width: $mobileBreakPoint) { @media (min-width: $mobileBreakPoint) {
padding: 2rem; padding: 2rem 0;
} }
} }

View File

@ -3,6 +3,9 @@
<app-section> <app-section>
<VueRemarkContent class="text" /> <VueRemarkContent class="text" />
</app-section> </app-section>
<app-section>
<page-navigation />
</app-section>
</Layout> </Layout>
</template> </template>
@ -20,10 +23,12 @@ query($path: String!) {
<script> <script>
import AppSection from '@/components/AppSection' import AppSection from '@/components/AppSection'
import PageNavigation from '@/components/PageNavigation'
export default { export default {
components: { components: {
AppSection, AppSection,
PageNavigation,
}, },
metaInfo() { metaInfo() {