<script lang="ts" setup>
import { ref } from 'vue'
import Upload from '../Upload.vue'

const props = defineProps<{
  value: string
  label: string
}>()

const emit = defineEmits<{
  (e: 'update:value', value: string): void
}>()

const url = ref<string>(props.value)

function onChange(value: string) {
  emit('update:value', value)
}
</script>

<template>
  <div class="wrapper">
    <n-collapse :default-expanded-names="['1']" arrow-placement="right">
      <n-collapse-item :title="label" name="1">
        <Upload v-model:value="url" @update:value="onChange" />
      </n-collapse-item>
    </n-collapse>
  </div>
</template>

<style lang="less" scoped>
.wrapper {
  padding: 10px;
  margin-top: 0;
}
::v-deep(.n-collapse-item-arrow){
  color: #999999 !important;;
}
::v-deep(.n-collapse-item__content-inner){
  padding-top: 0!important;
}
</style>
