All files / munch-ease-frontend/src/components/recipes RecipeCard.vue

0% Statements 0/53
0% Branches 0/1
0% Functions 0/1
0% Lines 0/53

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                           
<template>
  <div class="recipe-card">
    <p>
      <img
        v-if="recipe.imageUrls && recipe.imageUrls.length"
        :src="recipe.imageUrls[0] || fallbackEgg"
      >
      <img
        v-else
        :src="fallbackEgg"
      >
    </p>
    <p class="recipe-name">
      {{ recipe.name }}
    </p>
  </div>
</template>

<script setup lang="ts">
import type { RecipeOut } from '@/domain/types'
type RecipeCardItem = Pick<RecipeOut, 'id' | 'name' | 'imageUrls'>

defineProps<{ recipe: RecipeCardItem }>()
const fallbackEgg = new URL('@/assets/egg.svg', import.meta.url).toString()
</script>

<style scoped>
.recipe-card {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  text-align: left;
  max-height: 10em;
  margin: 0;
}

.recipe-card p {
  margin: auto 0;
  margin-right: 1em;
}

li img {
  display: block;
  width: 3em;
  height: 3em;
  object-fit: cover;
}

.recipe-name {
  flex: 1;
  margin: auto;
}
</style>