Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

fix for dropdown menu #9

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
],
"object-shorthand": "warn",
"vue/html-self-closing": "warn",
"no-console": "warn"
"no-debugger": "error"
}
}
3 changes: 1 addition & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ export default {
},
methods: {
changeHeaderHandler(e) {
Object.assign(this.options, e.detail);
this.options = e.detail;
},
changeDateHandler(e) {
console.log('change-date', e);
this.date = e.detail.date;
},
syncDateHandler() {
Expand Down
11 changes: 10 additions & 1 deletion src/components/BaseLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@
<DesktopMenu class="only-desktop" />
<div class="actions">
<slot name="actions" />
<DropdownMenu
v-if="menu.length > 0"
:menu="menu"
/>
</div>
</div>
</template>

<script>
import ButtonIcon from './ButtonIcon.vue';
import DesktopMenu from './DesktopMenu.vue';
import DropdownMenu from './DropdownMenu.vue';

export default {
components: { ButtonIcon, DesktopMenu },
components: { ButtonIcon, DesktopMenu, DropdownMenu },
props: {
title: {
type: String,
Expand All @@ -32,6 +37,10 @@ export default {
type: Boolean,
default: false,
},
menu: {
type: Array,
default: () => [],
},
},
methods: {
back() {
Expand Down
30 changes: 4 additions & 26 deletions src/components/ToolbarBack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,17 @@
<BaseLayout
:title="options.text"
:backable="true"
>
<template #actions>
<DropdownMenu
v-if="options.menu && options.menu.length > 0"
:menu="options.menu"
/>
</template>
</BaseLayout>
:menu="options.menu"
/>
</template>

<script>
import DropdownMenu from './DropdownMenu';
import { windowWidthMixin } from '../mixins';
import BaseLayout from './BaseLayout.vue';

export default {
components: { DropdownMenu, BaseLayout },
mixins: [windowWidthMixin],
components: { BaseLayout },
props: {
options: { type: Object, default: () => ({ text: 'Твой физфак!' }) },
},
methods: {
getButtons() {
return JSON.parse(localStorage.getItem('navbar-buttons'));
},
options: { type: Object, required: true },
},
};
</script>

<style scoped>
span,
div {
color: #ffffff;
margin-right: 16px;
}
</style>
14 changes: 2 additions & 12 deletions src/components/ToolbarCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
is-required
/>
</div>
<BaseLayout>
<BaseLayout :menu="options.menu">
<template #meta>
<button
class="toggle-button"
Expand Down Expand Up @@ -39,10 +39,6 @@
:disabled="options.disabled"
@click="updateDate(new Date())"
/>
<DropdownMenu
:menu="options.menu"
:disabled="options.disabled"
/>
</template>
</BaseLayout>
</div>
Expand All @@ -52,7 +48,6 @@
import 'v-calendar/dist/style.css';
import vClickOutside from 'click-outside-vue3';
import { DatePicker } from 'v-calendar';
import DropdownMenu from './DropdownMenu';
import ButtonIcon from './ButtonIcon';
import { windowWidthMixin } from '../mixins';
import BaseLayout from './BaseLayout.vue';
Expand All @@ -61,7 +56,6 @@ export default {
name: 'NavbarTop',
components: {
DatePicker,
DropdownMenu,
ButtonIcon,
BaseLayout,
},
Expand All @@ -72,11 +66,7 @@ export default {
props: {
options: {
type: Object,
default: () => ({
text: 'Твой физфак!',
menu: [],
disabled: true,
}),
required: true,
},
date: {
type: Date,
Expand Down
25 changes: 6 additions & 19 deletions src/components/ToolbarPlain.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
<template>
<BaseLayout :title="options.text">
<template #actions>
<DropdownMenu
v-if="options.menu && options.menu.length > 0"
:menu="options.menu"
/>
</template>
</BaseLayout>
<BaseLayout
:title="options.text"
:menu="options.menu"
/>
</template>

<script>
import DropdownMenu from './DropdownMenu';
import { windowWidthMixin } from '../mixins';
import BaseLayout from './BaseLayout.vue';

export default {
components: { DropdownMenu, BaseLayout },
mixins: [windowWidthMixin],
components: { BaseLayout },
props: {
options: { type: Object, default: () => ({ text: 'Твой физфак!' }) },
options: { type: Object, required: true },
},
};
</script>

<style scoped>
div {
color: #ffffff;
}
</style>