<template>
  <router-link
    :to="{ name: 'browse', params: { addresses: [result.entity] } }"
    class="search-result"
  >
    <div class="search-result-container">
      <div class="search-result-attribute">{{ result.attribute }}</div>
      <div class="search-result-value">{{ result.value.c }}</div>
    </div>
  </router-link>
</template>

<script lang="ts">
import { IEntry } from "@/types/base";
import { defineComponent, PropType } from "vue";

export default defineComponent({
  name: "SearchResult",
  props: {
    result: {
      type: Object as PropType<IEntry>,
      required: true,
    },
  },
});
</script>

<style scoped lang="scss">
.search-result {
  .search-result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--foreground);
    border-radius: 1rem;
    
    margin: 0.5rem;
    padding: 1rem;

    width: 100%;
    height: 100%;
  }

  text-align: center;

  color: --foreground;
  text-decoration: inherit;

  div {
    margin: 0.5rem 0;
  }

  .search-result-attribute {
    font-weight: bold;
  }
}
</style>
