Create Fruit details layout
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2><span @click="() => this.$router.back()">◀</span> Details</h2>
|
||||
{{ this.fruit }}
|
||||
<h2><span @click="() => this.$router.push('/')">◀</span> Details</h2>
|
||||
<article>
|
||||
<img :src="fruit.image" :alt="fruit.name" />
|
||||
<section>
|
||||
<h3>
|
||||
{{ fruit.name }}
|
||||
<span class="tag" :style="{ backgroundColor: fruit.color }">{{ fruit.taste }}</span>
|
||||
</h3>
|
||||
|
||||
<p>{{ fruit.description }}</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="price">{{ "$" + fruit.price }}</p>
|
||||
{{ fruit.expires }}
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,4 +30,82 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style lang="less" scoped>
|
||||
h2 span {
|
||||
cursor: pointer;
|
||||
}
|
||||
article {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-flow: column;
|
||||
|
||||
img,
|
||||
section {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
//max-height: 285px;
|
||||
object-fit: scale-down;
|
||||
margin-bottom: 1.5rem;
|
||||
box-shadow: 0 1px 4px 1px #d2d2f2;
|
||||
}
|
||||
|
||||
section {
|
||||
padding: 1.5rem 1rem;
|
||||
background-color: @secondary-color;
|
||||
|
||||
h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin-bottom: 0.55rem;
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 100px;
|
||||
color: #cece;
|
||||
margin: 1.35rem auto;
|
||||
}
|
||||
|
||||
.tag {
|
||||
border-radius: 25px;
|
||||
padding: 0.35rem 0.75rem;
|
||||
margin-left: 0.75rem;
|
||||
color: #ffffff;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
.price {
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: @sm) {
|
||||
flex-flow: row;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
|
||||
img,
|
||||
section {
|
||||
width: 50%;
|
||||
max-width: 485px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-height: 435px;
|
||||
margin-bottom: 0;
|
||||
margin-right: 1.5rem;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user