<script setup lang="ts">
const props = defineProps({
  code: {
    type: String,
    required: true,
  },
})

const { copied, copy } = useClipboard({ source: props.code })
</script>

<template>
  <UiButton
    :icon="copied ? 'i-ph:check-bold' : 'i-ph:copy-duotone'"
    variant="link"
    size="icon"
    class="not-prose text-foreground w-7 h-7"
    @click="copy()"
  />
</template>
