Skip to content

Commit

Permalink
feat: add Mantine drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
altrusl committed Dec 8, 2023
1 parent f807253 commit 1c5491c
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/assets/images/about.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/change-account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/contact-us.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/logout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions src/components/drawers/SimpleDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const isDrawerOpen = defineModel<boolean>();
</script>

<template>
<aside class="simple-drawer" :class="{ open: isDrawerOpen }">
<aside class="navigation-drawer" :class="{ open: isDrawerOpen }">
<slot />
</aside>
<div
Expand All @@ -14,21 +14,23 @@ const isDrawerOpen = defineModel<boolean>();
</template>

<style scoped lang="scss">
.simple-drawer {
.navigation-drawer {
z-index: 9999;
position: fixed;
// top: 0;
left: 0;
height: 100%;
width: 300px;
width: 270px;
translate: -300px 0;
transition: all 0.2s ease;
background-color: #eee;
// background-color: #eee;
background-color: white;
.notebook &,
.desktop & {
position: initial;
translate: 0;
}
&.open {
.mobile &.open, .tablet &.open {
translate: 0 0;
transition: all 0.4s ease;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/drawers/TouchSlideoutDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ onUnmounted(() => {
</script>

<template>
<aside ref="touchSlideout" class="touch-slideout" :class="{ open: isDrawerOpen }">
<aside ref="touchSlideout" class="navigation-drawer" :class="{ open: isDrawerOpen }">
<div ref="touchSlideoutWrapper" class="touch-slideout-wrapper">
<div class="touch-slideout-drawer">
<slot :close-drawer="close" />
Expand All @@ -223,7 +223,7 @@ onUnmounted(() => {
</template>

<style scoped lang="scss">
.touch-slideout {
.navigation-drawer {
z-index: 9999;
position: fixed;
// top: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/components/footers/MantineRichFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const socials = [
<style lang="scss" scoped>
.footer {
padding: 1em;
margin-top: 5rem;
margin-top: 1rem;
border-top: 1px solid #e9ecef;
background-color: #f8f9fa;
Expand Down
2 changes: 1 addition & 1 deletion src/components/footers/MantineSimpleFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const socials = [

<style lang="scss" scoped>
.footer {
margin-top: 5rem;
margin-top: 1rem;
border-top: 1px solid #e9ecef;
// .footer-inner {
align-items: none;
Expand Down
92 changes: 92 additions & 0 deletions src/components/navbars/MantineSimpleNavbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<script setup lang="ts">
import BaseIcon from "@/components/ui/BaseIcon.vue";
import { useAppConfig } from "@/composables/useAppConfig";
const { closeDrawer } = useAppConfig();
const links = [
{ name: "home", label: "Home", icon: "home" },
{ name: "about", label: "About", icon: "about" },
{ name: "contacts", label: "Contact us", icon: "contact-us" },
];
const footerLinks = [
{ name: "home", label: "Change account", icon: "change-account" },
{ name: "home", label: "Logout", icon: "logout" },
];
</script>

<template>
<nav class="navbar">
<div class="main">
<ul>
<li v-for="link in links" :key="link.label">
<router-link v-slot="{ navigate }" :to="{ name: link.name }" custom @click="closeDrawer">
<BaseIcon size="30" :name="link.icon" class="icon" fill1="currentColor" />
<a role="link" @click="navigate">{{ link.label }}</a>
</router-link>
</li>
</ul>
</div>
<div class="footer">
<ul>
<li v-for="link in footerLinks" :key="link.label">
<router-link v-slot="{ navigate }" :to="{ name: link.name }" custom @click="closeDrawer">
<BaseIcon size="30" :name="link.icon" class="icon" />
<a role="link" @click="navigate">{{ link.label }}</a>
</router-link>
</li>
</ul>
</div>
</nav>
</template>

<style lang="scss" scoped>
.navbar {
min-width: 220px;
padding: 1em;
border-right: 1px solid #ccc;
.notebook & {
min-width: 220px;
}
.main, .footer {
ul {
list-style-type: none;
padding-left: 0;
li {
line-height: 3em;
display: flex;
align-items: center;
color: #888;
// border-bottom: solid 1px rgb(200, 200, 200);
&:hover {
color: #444;
background-color: #f9f9f9;
}
a {
cursor: pointer;
display: block;
padding: 0 2em 0 1em;
color: #888;
}
// .icon {
// color: #444;
// }
}
}
}
.main {
padding-bottom: 2em;
}
.footer {
// padding-top: 1em;
margin-top: 1em;
border-top: 1px solid #ccc;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { closeDrawer } = useAppConfig();
const links = [
{ name: "home", label: "Home" },
{ name: "about", label: "About" },
{ name: "contacts", label: "Contacts" },
{ name: "contacts", label: "Contact us" },
];
</script>

Expand All @@ -15,7 +15,7 @@ const links = [
<ul>
<li v-for="link in links" :key="link.label">
<router-link v-slot="{ navigate }" :to="{ name: link.name }" custom @click="closeDrawer">
<a role="link" @click="navigate" @keypress.enter="navigate">{{ link.label }}</a>
<a role="link" @click="navigate">{{ link.label }}</a>
</router-link>
</li>
</ul>
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/BaseIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const height = computed(() => {
v-if="getSvgIcon(props.name)"
class="base-icon"
:data-name="props.name"
:fill="props.fill ?? 'currentColor'"
:fill1="props.fill ?? 'currentColor'"
stroke="currentColor"
:style="{
width,
Expand Down Expand Up @@ -78,6 +78,7 @@ const height = computed(() => {
stroke: currentColor;
stroke-width: 1.5;
fill: v-bind('props.fill');
// fill: v-bind('props.fill ?? "currentColor"');
}
}
</style>
20 changes: 13 additions & 7 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<script setup lang="ts">
import AppContentPane from "@/components/AppContentPane.vue";
import AppNavigationDrawer from "@/components/drawers/TouchSlideoutDrawer.vue";
import AppSidebar from "@/components/AppSidebar.vue";
import AppNavigationDrawer from "@/components/drawers/SimpleDrawer.vue";
// import AppNavigationDrawer from "@/components/drawers/TouchSlideoutDrawer.vue";
// import AppSidebar from "@/components/navbars/SimpleNavbar.vue";
import AppSidebar from "@/components/navbars/MantineSimpleNavbar.vue";
import AppHeader from "@/components/headers/MantineSimpleHeader.vue";
// import AppHeader from "@/components/headers/MantineSimpleHeader.vue";
// import AppHeader from "@/components/headers/MantineSimpleHeader.vue";
// import AppHeader from "@/components/headers/MantineLayeredHeader.vue";
import AppHeader from "@/components/headers/SimpleHeader.vue";
// import AppHeader from "@/components/headers/SimpleHeader.vue";
// import AppFooter from "@/components/footers/RichFooter.vue";
// import AppFooter from "@/components/footers/DistributedFooter.vue";
// import AppFooter from "@/components/footers/MantineSimpleFooter.vue";
import AppFooter from "@/components/footers/MantineSimpleFooter.vue";
// import AppFooter from "@/components/footers/MantineRichFooter.vue";
import AppFooter from "@/components/footers/SimpleFooter.vue";
// import AppFooter from "@/components/footers/SimpleFooter.vue";
import { useAppConfig } from "@/composables/useAppConfig";
Expand Down

0 comments on commit 1c5491c

Please sign in to comment.