Sharkey/packages/frontend/src/components/MkKeyValue.vue
Shun Sakai c2370a1be6
chore: 著作権とライセンスについての情報を各ファイルに追加する (#11348)
* chore: Add the SPDX information to each file

Add copyright and licensing information as defined in version 3.0 of
the REUSE Specification.

* tweak format

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-07-27 14:31:52 +09:00

63 lines
1.1 KiB
Vue

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div :class="[$style.root, { [$style.oneline]: oneline }]">
<div :class="$style.key">
<slot name="key"></slot>
</div>
<div :class="$style.value">
<slot name="value"></slot>
<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>
</div>
</div>
</template>
<script lang="ts" setup>
import { } from 'vue';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import * as os from '@/os';
import { i18n } from '@/i18n';
const props = withDefaults(defineProps<{
copy?: string | null;
oneline?: boolean;
}>(), {
copy: null,
oneline: false,
});
const copy_ = () => {
copyToClipboard(props.copy);
os.success();
};
</script>
<style lang="scss" module>
.root {
&.oneline {
display: flex;
.key {
width: 30%;
font-size: 1em;
padding: 0 8px 0 0;
}
.value {
width: 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.key {
font-size: 0.85em;
padding: 0 0 0.25em 0;
opacity: 0.75;
}
</style>