Skip to content

Commit 202bc11

Browse files
committed
Added drawers
1 parent c96959b commit 202bc11

File tree

6 files changed

+210
-131
lines changed

6 files changed

+210
-131
lines changed

components/Drawer/index.vue

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<div class="drawer">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'Drawer',
10+
props: {
11+
index: {
12+
type: Number,
13+
default: 0
14+
}
15+
},
16+
data() {
17+
return {
18+
activeItem: this.index,
19+
items: []
20+
}
21+
},
22+
methods: {
23+
changeItem(newIndex) {
24+
if (this.activeItem === newIndex) return
25+
this.items[this.activeItem].deactivate()
26+
this.items[newIndex].activate()
27+
this.activeItem = newIndex
28+
}
29+
},
30+
mounted() {
31+
if (this.items.length) {
32+
this.items[this.activeItem].isActive = true
33+
}
34+
}
35+
}
36+
</script>
37+
38+
39+
<style lang="scss" scoped>
40+
.drawer {
41+
display: flex;
42+
flex-direction: column;
43+
height: 92vh;
44+
}
45+
</style>

components/DrawerItem/index.vue

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<template>
2+
<div
3+
class="drawer-item"
4+
:class="{
5+
'is-active': isActive
6+
}"
7+
@click="onClick">
8+
<h2 class="drawer-item-title">{{ title }}</h2>
9+
<div class="drawer-item-content">
10+
<slot/>
11+
</div>
12+
</div>
13+
</template>
14+
15+
<script>
16+
export default {
17+
name: 'DrawerItem',
18+
props: {
19+
title: String
20+
},
21+
data() {
22+
return {
23+
isActive: false
24+
}
25+
},
26+
methods: {
27+
activate() {
28+
this.isActive = true
29+
},
30+
deactivate() {
31+
this.isActive = false
32+
},
33+
onClick() {
34+
this.$parent.changeItem(this.$parent.items.indexOf(this))
35+
}
36+
},
37+
created() {
38+
this.$parent.items.push(this)
39+
}
40+
}
41+
</script>
42+
43+
<style lang="scss" scoped>
44+
.drawer-item {
45+
display: inline-block;
46+
height: 8vh;
47+
width: 100vw;
48+
margin-bottom: -4px;
49+
background-color: #343332;
50+
box-shadow: 0px 0px 24px rgba(0, 0, 0, 0.5);
51+
transition: .5s ease;
52+
53+
&.is-active {
54+
display: flex;
55+
flex-direction: column;
56+
height: 100%;
57+
}
58+
59+
.drawer-item-title,
60+
.drawer-item-content {
61+
padding: 0 24px;
62+
white-space: nowrap;
63+
color: #ffffff;
64+
}
65+
66+
.drawer-item-title {
67+
margin-top: 32px;
68+
margin-bottom: 24px;
69+
font-size: 42px;
70+
}
71+
72+
.drawer-item-content {
73+
height: 100%;
74+
color: #f2f2f2;
75+
}
76+
}
77+
</style>

components/Search/index.vue

Lines changed: 0 additions & 84 deletions
This file was deleted.

layouts/default.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ body {
4747
background-color: rgba(18, 18, 18, 1);
4848
}
4949
50+
p {
51+
margin: 0;
52+
}
53+
5054
.wrapper {
5155
min-height: 100vh;
5256
width: 100%;

nuxt.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ module.exports = {
2626
],
2727
link: [
2828
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,700&display=swap' },
29-
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
30-
{ rel: 'preload', href: '/images/standby.png', as: 'image' },
31-
{ rel: 'preload', href: '/images/walk.png', as: 'image' },
32-
{ rel: 'preload', href: '/images/attack.png', as: 'image' }
29+
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
3330
]
3431
},
3532

0 commit comments

Comments
 (0)