2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-11-28 11:07:37 +00:00
|
|
|
<template>
|
2023-05-19 04:58:09 +00:00
|
|
|
<div :class="[$style.root, { [$style.oneline]: oneline }]">
|
|
|
|
<div :class="$style.key">
|
2021-11-28 11:07:37 +00:00
|
|
|
<slot name="key"></slot>
|
|
|
|
</div>
|
2023-05-19 04:58:09 +00:00
|
|
|
<div :class="$style.value">
|
2021-11-28 11:07:37 +00:00
|
|
|
<slot name="value"></slot>
|
2022-12-20 06:24:31 +00:00
|
|
|
<button v-if="copy" v-tooltip="i18n.ts.copy" class="_textButton" style="margin-left: 0.5em;" @click="copy_"><i class="ti ti-copy"></i></button>
|
2021-11-28 11:07:37 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-06-25 02:50:19 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2021-11-28 11:07:37 +00:00
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
|
|
|
import * as os from '@/os';
|
2022-07-20 13:24:26 +00:00
|
|
|
import { i18n } from '@/i18n';
|
2021-11-28 11:07:37 +00:00
|
|
|
|
2022-06-25 02:50:19 +00:00
|
|
|
const props = withDefaults(defineProps<{
|
2022-06-29 05:19:40 +00:00
|
|
|
copy?: string | null;
|
|
|
|
oneline?: boolean;
|
2022-06-25 02:50:19 +00:00
|
|
|
}>(), {
|
|
|
|
copy: null,
|
|
|
|
oneline: false,
|
2021-11-28 11:07:37 +00:00
|
|
|
});
|
2022-06-25 02:50:19 +00:00
|
|
|
|
|
|
|
const copy_ = () => {
|
|
|
|
copyToClipboard(props.copy);
|
|
|
|
os.success();
|
|
|
|
};
|
2021-11-28 11:07:37 +00:00
|
|
|
</script>
|
|
|
|
|
2023-05-19 04:58:09 +00:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2022-01-04 06:36:14 +00:00
|
|
|
&.oneline {
|
|
|
|
display: flex;
|
|
|
|
|
2023-05-19 04:58:09 +00:00
|
|
|
.key {
|
2022-01-04 06:36:14 +00:00
|
|
|
width: 30%;
|
|
|
|
font-size: 1em;
|
|
|
|
padding: 0 8px 0 0;
|
|
|
|
}
|
|
|
|
|
2023-05-19 04:58:09 +00:00
|
|
|
.value {
|
2022-01-04 06:36:14 +00:00
|
|
|
width: 70%;
|
2022-06-25 02:50:19 +00:00
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2022-01-04 06:36:14 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-28 11:07:37 +00:00
|
|
|
}
|
2023-05-19 04:58:09 +00:00
|
|
|
|
|
|
|
.key {
|
|
|
|
font-size: 0.85em;
|
|
|
|
padding: 0 0 0.25em 0;
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
2021-11-28 11:07:37 +00:00
|
|
|
</style>
|