Problem:
Normally the first <User> should have margin-left: 0px and should align to the left with the other elements but this doesn't work as you can see in the screenshot below. Anyone got an idea how to fix this properly?
sidebar.scss Code:
.user {
margin-left: -8px;
&:first-child {
margin-left: 0;
}
}
Sidebar.vue Code
<template>
<section class="sidebar">
<slot></slot>
</section>
</template>
<script>
export default {
name: "Sidebar"
}
</script>
<style scoped lang="scss">
@import 'sidebar';
</style>
Profile.vue Code
<template>
<main>
<Sidebar>
<Header text="Members" :button="{text: 'Edit'}" hasBorder="true"></Header>
<User img="..."></User>
<User img="..."></User>
<User img="..."></User>
<User img="..."></User>
<Button color="grey" isRounded="true" isIconOnly="true"></Button>
</Sidebar>
</main>
</template>
User.vue code:
<template>
<div class="user">
<img v-if="this.img" :src="this.img" :alt="this.name">
<div v-if="!this.img"></div>
<h6 v-if="this.name">{{this.name}}</h6>
<slot></slot>
</div>
</template>
