<!DOCTYPE html>
<html>
<head>
  <title>Show Food Image</title>
  <style>
    #app {
      border: dashed black 1px;
      width: 220px;
      padding: 20px;
    }

    #app > img {
      float: right;
      width: 55%;
    }

    li:hover {
      cursor: pointer;
      background-color: rgb(224, 224, 224);
    }

    #app > ol {
      list-style-type: none;
      margin: 0;
      padding: 0;
    }

    #app li {
      padding-left: 6px;
      border-radius: 5px;
      width: 70px;
    }
	
	.descriptionOfItem {
		color: red;
		font-weight: bold;
		text-align: center;
	}
  </style>
</head>
<body>

<h1>Example: Show Food Image</h1>

<p>Click on a food name below to see an image of it.</p>

<div id="app">
  <img v-bind:src="selectedFood.url" alt="food image">
  

  <ol>
    <li v-for="food in manyFoods" @click="selectedFood = food">
      {{ food.name }} 
    </li>
  </ol>
  
  <p class="descriptionOfItem">{{ selectedFood.description }}</p>
  
</div>

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
  const app = Vue.createApp({
    data() {
      return {
        selectedFood: {
          name: 'Pizza',
          url: 'img_pizza.svg',
          description: 'food'
        },
        manyFoods: [
          {name: 'Burrito', url: 'img_burrito.svg', description: 'food'},
          {name: 'Salad', url: 'img_salad.svg', description: 'food'},
          {name: 'Cake', url: 'img_cake.svg', description: 'food'},
          {name: 'Soup', url: 'img_soup.svg', description: 'food'},
          {name: 'Fish', url: 'img_fish.svg', description: 'food'},
          {name: 'Pizza', url: 'img_pizza.svg', description: 'food'},
          {name: 'Rice', url: 'img_rice.svg', description: 'food'},
          {name: 'Water', url: 'img_water.svg', description: 'drink'}
        ]
      };
    }
  });

  app.mount('#app');
</script>

</body>
</html>
