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