<template>
  <div class="MoreButton">
    <n-button text :color="option.buttonStyle.color" size="large">
      <span :style="{ fontSize: option.buttonStyle.fontSize + 'px' }">{{ option.buttonName }}</span>
      <Title v-if="option.buttonStyle.iconFlag" class="title" :buttonStyle="option.buttonStyle" />
    </n-button>
  </div>
</template>

<script setup lang="ts">
  import { computed, PropType, toRefs, watch, reactive, ref } from 'vue';
  import { CreateComponentType } from '@/packages/index.d';
  import { icon } from '@/plugins';
  import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
  import { useChartDataFetch } from '@/hooks';
  import Title from './svg/title.vue';

  const props = defineProps({
    chartConfig: {
      type: Object as PropType<CreateComponentType>,
      required: true,
    },
  });

  const { w, h } = toRefs(props.chartConfig.attr);

  const option = reactive({
    buttonName: props.chartConfig.option.buttonName,
    buttonStyle: props.chartConfig.option.buttonStyle,
  });
</script>

<style lang="scss" scoped>
  .MoreButton {
    display: flex;
    justify-content: center;
    text-align: center;
    width: v-bind('`${w}px`');
    height: v-bind('`${h}px`');
  }

  .title {
    margin-left: v-bind('`${option.buttonStyle.iconMarginLeft}px`');
  }
</style>
