mizzkey/packages/frontend/src/components/MkSuperMenu.vue

271 lines
6.4 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
2021-10-10 08:19:16 +02:00
<template>
<div class="rrevdjwu" :class="{ grid }">
2021-11-19 11:36:12 +01:00
<div v-for="group in def" class="group">
<div v-if="group.title" class="title">{{ group.title }}</div>
2021-10-10 08:19:16 +02:00
<div class="items">
<template v-for="(item, i) in group.items">
2023-09-23 02:01:20 +02:00
<a v-if="item.type === 'a'" :href="item.href" :target="item.target" :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active, gamingDark: gaming === 'dark',gamingLight: gaming === 'light' }">
2023-01-25 11:45:25 +01:00
<span v-if="item.icon" class="icon"><i :class="item.icon" class="ti-fw"></i></span>
2021-10-10 08:19:16 +02:00
<span class="text">{{ item.text }}</span>
</a>
2023-09-23 02:01:20 +02:00
<button v-else-if="item.type === 'button'" :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active , gamingDark: gaming === 'dark',gamingLight: gaming === 'light' }" :disabled="item.active" @click="ev => item.action(ev)">
2023-01-25 11:45:25 +01:00
<span v-if="item.icon" class="icon"><i :class="item.icon" class="ti-fw"></i></span>
2021-10-10 08:19:16 +02:00
<span class="text">{{ item.text }}</span>
</button>
2023-09-23 02:01:20 +02:00
<MkA v-else :to="item.to" :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active , gamingDark: gaming === 'dark',gamingLight: gaming === 'light' }">
2023-01-25 11:45:25 +01:00
<span v-if="item.icon" class="icon"><i :class="item.icon" class="ti-fw"></i></span>
2021-10-10 08:19:16 +02:00
<span class="text">{{ item.text }}</span>
</MkA>
</template>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
2023-09-23 02:01:20 +02:00
import {ref , computed , watch } from 'vue';
import {defaultStore} from "@/store.js";
2021-10-10 08:19:16 +02:00
2023-09-23 02:01:20 +02:00
let gaming = ref('');
const gamingMode = computed(defaultStore.makeGetterSetter('gamingMode'));
const darkMode = computed(defaultStore.makeGetterSetter('darkMode'));
if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light';
} else {
gaming.value = '';
}
watch(darkMode, () => {
if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light';
} else {
gaming.value = '';
}
})
watch(gamingMode, () => {
if (darkMode.value && gamingMode.value == true) {
gaming.value = 'dark';
} else if (!darkMode.value && gamingMode.value == true) {
gaming.value = 'light';
} else {
gaming.value = '';
}
})
defineProps<{
def: any[];
grid?: boolean;
}>();
2021-10-10 08:19:16 +02:00
</script>
<style lang="scss" scoped>
2021-10-10 08:19:16 +02:00
.rrevdjwu {
> .group {
& + .group {
margin-top: 16px;
padding-top: 16px;
border-top: solid 0.5px var(--divider);
}
> .title {
opacity: 0.7;
2021-12-02 12:09:12 +01:00
margin: 0 0 8px 0;
2021-12-10 07:33:01 +01:00
font-size: 0.9em;
2021-10-10 08:19:16 +02:00
}
2021-10-10 08:19:16 +02:00
> .items {
> .item {
display: flex;
align-items: center;
width: 100%;
box-sizing: border-box;
2023-01-04 01:52:49 +01:00
padding: 9px 16px 9px 8px;
2021-10-15 18:15:22 +02:00
border-radius: 9px;
2022-07-12 15:42:50 +02:00
font-size: 0.9em;
2021-10-10 08:19:16 +02:00
&:hover {
text-decoration: none;
background: var(--panelHighlight);
}
&.active {
color: var(--accent);
background: var(--accentedBg);
2023-09-23 02:01:20 +02:00
&.gamingDark{
color: black !important;
background: linear-gradient(270deg, #e7a2a2, #e3cfa2, #ebefa1, #b3e7a6, #a6ebe7, #aec5e3, #cabded, #e0b9e3, #f4bddd); background-size: 1800% 1800%;
2023-09-24 19:02:33 +02:00
-webkit-animation: AnimationDark var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite;
-moz-animation: AnimationDark var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite;
animation: AnimationDark var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite;
2023-09-23 02:01:20 +02:00
}
&.gamingLight{
color: white;
background: linear-gradient(270deg, #c06161, #c0a567, #b6ba69, #81bc72, #63c3be, #8bacd6, #9f8bd6, #d18bd6, #d883b4);
background-size: 1800% 1800% !important;
2023-09-24 19:02:33 +02:00
-webkit-animation: AnimationLight var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite !important;
-moz-animation: AnimationLight var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite !important;
animation: AnimationLight var(--gamingspeed) cubic-bezier(0, 0.2, 0.90, 1) infinite !important;
2023-09-23 02:01:20 +02:00
}
2021-10-10 08:19:16 +02:00
}
&.danger {
color: var(--error);
}
> .icon {
width: 32px;
margin-right: 2px;
flex-shrink: 0;
text-align: center;
opacity: 0.8;
}
> .text {
white-space: normal;
2021-10-10 08:19:16 +02:00
padding-right: 12px;
flex-shrink: 1;
2021-10-10 08:19:16 +02:00
}
}
}
}
&.grid {
> .group {
& + .group {
padding-top: 0;
border-top: none;
}
margin-left: 0;
margin-right: 0;
> .title {
font-size: 1em;
opacity: 0.7;
margin: 0 0 8px 16px;
}
> .items {
display: grid;
2022-12-21 00:39:28 +01:00
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
2022-12-20 05:20:19 +01:00
grid-gap: 16px;
2021-10-10 08:19:16 +02:00
padding: 0 16px;
> .item {
flex-direction: column;
text-align: center;
2022-12-20 05:20:19 +01:00
padding: 0;
2021-10-10 08:19:16 +02:00
2022-12-20 05:21:40 +01:00
&:hover {
text-decoration: none;
background: none;
color: var(--accent);
> .icon {
background: var(--accentedBg);
}
}
2021-10-10 08:19:16 +02:00
> .icon {
2022-12-20 05:20:19 +01:00
display: grid;
place-content: center;
2021-10-10 08:19:16 +02:00
margin-right: 0;
2022-12-20 05:20:19 +01:00
margin-bottom: 6px;
2021-10-10 08:19:16 +02:00
font-size: 1.5em;
2023-01-05 11:50:52 +01:00
width: 60px;
height: 60px;
2022-12-20 05:20:19 +01:00
aspect-ratio: 1;
background: var(--panel);
border-radius: 100%;
2021-10-10 08:19:16 +02:00
}
> .text {
padding-right: 0;
width: 100%;
font-size: 0.8em;
}
}
}
}
}
}
2023-09-23 02:01:20 +02:00
@-webkit-keyframes AnimationLight {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes AnimationLight {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
} @keyframes AnimationLight {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-webkit-keyframes AnimationDark {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes AnimationDark {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@keyframes AnimationDark {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
2021-10-10 08:19:16 +02:00
</style>
2023-09-23 02:01:20 +02:00