<template>
  <div class="wrapper">
    <div v-if="isShowAllBtn" class="show" @click="handleSwitchShowAll">
      <div class="text text-compact">{{ isShowAll ? '收起' : '展开全部' }}</div>
      <div class="icon">
        <img v-if="isShowAll" src="./arrow-up.svg" alt="">
        <img v-else src="./arrow-down.svg" alt="">
      </div>
    </div>
    <div class="clear text-tip-1" @click="handleClear">
      {{ '清空条件' }}
    </div>
    <div class="confirm text-tip-1" @click="handleConfirm">
      {{ '确定' }}
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const props = defineProps({
  isShowAll: {
    type: Boolean,
    default: false
  },
  isShowAllBtn: {
    type: Boolean,
    default: true
  }
})

const handleSwitchShowAll = () => {
  emit('showAll')
}

const emit = defineEmits(['showAll', 'clear', 'confirm'])

const handleClear = () => {
  emit('clear')
}

const handleConfirm = () => {
  emit('confirm')
}


</script>

<style lang="scss" scoped>
.wrapper {
  height: 36px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;

  .show {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;

    .text {
      color: var(--color-primary-100);
    }

    .icon {
      width: 16px;
      height: 16px;

      img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .clear {
    width: 98px;
    height: 36px;
    border-radius: 4px;
    box-sizing: border-box;
    border: 1px solid var(--bg-black-10);
    text-align: center;
    padding: 6px 16px;
    color: var(--text-primary-65-color);
    cursor: pointer;

    &:hover {
      box-shadow: 0px 0px 20px 0px rgba(25, 69, 130, 0.1);
    }
  }

  .confirm {
    width: 150px;
    height: 36px;
    border-radius: 4px;
    box-sizing: border-box;
    padding: 6px 59px;
    background: var(--color-primary-100);
    color: var(--bg-white-100);
    text-align: center;
    cursor: pointer;

    &:hover {
      box-shadow: 0px 0px 20px 0px rgba(25, 69, 130, 0.1);
    }
  }
}
</style>