iceshrimp/packages/client/src/components/MkKeyValue.vue

70 lines
1.1 KiB
Vue
Raw Normal View History

2021-11-28 20:07:37 +09:00
<template>
2023-04-08 09:01:42 +09:00
<div class="alqyeyti" :class="{ oneline }">
<div class="key">
<slot name="key"></slot>
</div>
<div class="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="ph-clipboard-text ph-bold"></i>
</button>
</div>
2021-11-28 20:07:37 +09:00
</div>
</template>
<script lang="ts" setup>
2023-04-08 09:01:42 +09:00
import {} from "vue";
import copyToClipboard from "@/scripts/copy-to-clipboard";
import * as os from "@/os";
import { i18n } from "@/i18n";
2021-11-28 20:07:37 +09:00
2023-04-08 09:01:42 +09:00
const props = withDefaults(
defineProps<{
copy?: string | null;
oneline?: boolean;
}>(),
{
copy: null,
oneline: false,
}
);
const copy_ = () => {
copyToClipboard(props.copy);
os.success();
};
2021-11-28 20:07:37 +09:00
</script>
<style lang="scss" scoped>
.alqyeyti {
> .key {
font-size: 0.85em;
padding: 0 0 0.25em 0;
opacity: 0.75;
}
2022-01-04 15:36:14 +09:00
&.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;
2022-01-04 15:36:14 +09:00
}
}
2021-11-28 20:07:37 +09:00
}
</style>