2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-11-28 12:07:37 +01:00
|
|
|
<template>
|
2023-05-27 04:35:26 +02:00
|
|
|
<div :class="[$style.root, { [$style.inline]: inline }]">
|
|
|
|
<a v-if="external" :class="$style.main" class="_button" :href="to" target="_blank">
|
|
|
|
<span :class="$style.icon"><slot name="icon"></slot></span>
|
|
|
|
<span :class="$style.text"><slot></slot></span>
|
|
|
|
<span :class="$style.suffix">
|
|
|
|
<span :class="$style.suffixText"><slot name="suffix"></slot></span>
|
2023-09-30 21:53:52 +02:00
|
|
|
<i class="ph-arrow-square-out ph-bold ph-lg"></i>
|
2021-11-28 12:07:37 +01:00
|
|
|
</span>
|
|
|
|
</a>
|
2023-12-03 20:01:05 +01:00
|
|
|
<a v-else-if="onClick" :class="[$style.main, { [$style.active]: active }]" class="_button" :behavior="behavior" @click="onClick">
|
2023-05-27 04:35:26 +02:00
|
|
|
<span :class="$style.icon"><slot name="icon"></slot></span>
|
|
|
|
<span :class="$style.text"><slot></slot></span>
|
|
|
|
<span :class="$style.suffix">
|
|
|
|
<span :class="$style.suffixText"><slot name="suffix"></slot></span>
|
2023-09-30 21:53:52 +02:00
|
|
|
<i class="ph-caret-right ph-bold ph-lg"></i>
|
2021-11-28 12:07:37 +01:00
|
|
|
</span>
|
2023-12-03 20:01:05 +01:00
|
|
|
</a>
|
|
|
|
<MkA v-else :class="[$style.main, { [$style.active]: active }]" class="_button" :to="to" :behavior="behavior">
|
2023-12-03 19:59:01 +01:00
|
|
|
<span :class="$style.icon"><slot name="icon"></slot></span>
|
|
|
|
<span :class="$style.text"><slot></slot></span>
|
|
|
|
<span :class="$style.suffix">
|
|
|
|
<span :class="$style.suffixText"><slot name="suffix"></slot></span>
|
|
|
|
<i class="ph-caret-right ph-bold ph-lg"></i>
|
|
|
|
</span>
|
2023-12-03 20:01:05 +01:00
|
|
|
</MkA>
|
2021-11-28 12:07:37 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-07-25 14:24:37 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2022-07-25 14:24:37 +02:00
|
|
|
const props = defineProps<{
|
2023-12-03 20:01:05 +01:00
|
|
|
to: string;
|
2022-07-25 14:24:37 +02:00
|
|
|
active?: boolean;
|
|
|
|
external?: boolean;
|
2023-12-03 19:59:01 +01:00
|
|
|
onClick?: () => void;
|
2023-05-27 04:38:08 +02:00
|
|
|
behavior?: null | 'window' | 'browser';
|
2022-07-25 14:24:37 +02:00
|
|
|
inline?: boolean;
|
|
|
|
}>();
|
2021-11-28 12:07:37 +01:00
|
|
|
</script>
|
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2021-11-28 12:07:37 +01:00
|
|
|
display: block;
|
|
|
|
|
|
|
|
&.inline {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
2023-05-27 04:35:26 +02:00
|
|
|
}
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
.main {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 10px 14px;
|
|
|
|
background: var(--buttonBg);
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-sm);
|
2023-05-27 04:35:26 +02:00
|
|
|
font-size: 0.9em;
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
background: var(--buttonHoverBg);
|
|
|
|
}
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
background: var(--buttonHoverBg);
|
|
|
|
}
|
|
|
|
}
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
.icon {
|
|
|
|
margin-right: 0.75em;
|
|
|
|
flex-shrink: 0;
|
|
|
|
text-align: center;
|
|
|
|
color: var(--fgTransparentWeak);
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
&:empty {
|
|
|
|
display: none;
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
& + .text {
|
|
|
|
padding-left: 4px;
|
2021-11-28 12:07:37 +01:00
|
|
|
}
|
2023-05-27 04:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
.text {
|
|
|
|
flex-shrink: 1;
|
|
|
|
white-space: normal;
|
|
|
|
padding-right: 12px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
.suffix {
|
|
|
|
margin-left: auto;
|
|
|
|
opacity: 0.7;
|
|
|
|
white-space: nowrap;
|
2021-11-28 12:07:37 +01:00
|
|
|
|
2023-05-27 04:35:26 +02:00
|
|
|
> .suffixText:not(:empty) {
|
|
|
|
margin-right: 0.75em;
|
2021-11-28 12:07:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|