<script setup lang="ts">
import { ref } from "vue";
import { colors } from "./../configs";

const legends = ref(Object.values(colors));
</script>

<template>
  <ul class="legend__container">
    <li class="legend___item" v-for="legend in legends" :key="legend.border">
      <p
        class="legend--color"
        :style="{
          background: legend.background,
          border: `1px solid ${legend.border}`
        }"
      />
      <p>{{ legend.text }}</p>
    </li>
  </ul>
</template>

<style scoped>
.legend__container {
  width: 150px;
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 10px;
  box-sizing: border-box;
  background: #fff;
}

.legend__container > .legend___item {
  display: flex;
  align-items: center;
}

.legend--color {
  width: 15px;
  height: 15px;
  margin-right: 20px;
  border-radius: 2px;
}
</style>
