<template>
  <span class="importance-badge" :class="'importance-' + level">
    <span class="importance-dot"></span>
    {{ label }}
  </span>
</template>

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

const props = defineProps({
  label: { type: String, required: true },
})

const level = computed(() => {
  if (props.label.includes('特别重大') || props.label.includes('高')) return 'high'
  if (props.label.includes('重大') || props.label.includes('中') || props.label.includes('橙')) return 'medium'
  if (props.label.includes('关注') || props.label.includes('黄')) return 'warning'
  return 'low'
})
</script>

<style scoped>
.importance-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 24px;
}

.importance-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}
 
.importance-high {
  background: rgba(206, 79, 81, 0.1);
  color: rgba(206, 79, 81, 1);
}
.importance-high .importance-dot {
  background: rgba(206, 79, 81, 1);
}
 
.importance-medium {
  background: rgba(255, 149, 77, 0.1);
  color: rgba(255, 149, 77, 1);
}
.importance-medium .importance-dot {
  background: rgba(255, 149, 77, 1);
}
 
.importance-warning {
  background: rgba(232, 189, 11, 0.1);
  color: rgba(232, 189, 11, 1);
}
.importance-warning .importance-dot {
  background: rgba(232, 189, 11, 1);
}
 
.importance-low {
  background: rgba(33, 129, 57, 0.1);
  color: rgba(33, 129, 57, 1);
}
.importance-low .importance-dot {
  background: rgba(33, 129, 57, 1);
}
</style>
