Skip to content

Commit

Permalink
Fix BEM compliance
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
  • Loading branch information
marcoambrosini committed Apr 16, 2021
1 parent 26f5596 commit a67978b
Showing 1 changed file with 48 additions and 63 deletions.
111 changes: 48 additions & 63 deletions src/components/ListItem/ListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<template v-slot:subtitle>
In this slot you can put both text and other components such as icons
</template>
<AppNavigationCounter #counter">
<AppNavigationCounter #counter>
7
</AppNavigationCounter>
<template #actions>
Expand Down Expand Up @@ -78,27 +78,31 @@
<!-- Main content -->
<div class="list-item-content">
<div class="list-item-content__main">
<div class="list-item-content__line-one">

<!-- First line, title and details -->
<div class="line-one">
<span
class="list-item-content__line-one__title"
class="line-one__title"
:class="{'bold': bold}">
{{ title }}
</span>
<span
v-if="hasDetails && !displayActions"
class="list-item-content__line-one__details">
class="line-one__details">
{{ details }}
</span>
</div>
<div class="list-item-content__line-two"

<!-- Second line, subtitle and counter -->
<div class="line-two"
:class="{'bold': bold}">
<span v-if="hasSubtitle" class="list-item-content__line-two__subtitle">
<span v-if="hasSubtitle" class="line-two__subtitle">
<!-- @slot Slot for the second line of the component -->
<slot name="subtitle" />
</span>

<!-- Counter -->
<span v-if="!displayActions" class="list-item-content__line-two__counter">
<span v-if="!displayActions" class="line-two__counter">
<AppNavigationCounter
v-if="counterNumber != 0"
:highlighted="counterHighlighted">
Expand All @@ -107,6 +111,8 @@
</span>
</div>
</div>

<!-- Actions -->
<div
v-show="displayActions"
class="list-item-content__actions"
Expand Down Expand Up @@ -394,47 +400,6 @@ export default {
margin: auto 0;
}
&__line-one {
display: flex;
align-items: center;
justify-content: space-between;
white-space: nowrap;
margin: 0 auto;
&__title {
overflow: hidden;
flex-grow: 1;
cursor: pointer;
text-overflow: ellipsis;
color: var(--color-main-text);
}
&__details {
color: var(--color-text-lighter);
margin: 0 8px;
}
}
&__line-two {
display: flex;
align-items: flex-start;
justify-content: space-between;
white-space: nowrap;
&__subtitle {
overflow: hidden;
flex-grow: 1;
padding-right: 4px;
cursor: pointer;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--color-text-lighter);
}
&__counter {
margin: 2px 4px 0 0;
}
}
&__actions {
flex: 0 0 auto;
align-self: center;
Expand All @@ -444,26 +409,46 @@ export default {
}
}
// Counter
::v-deep .counter {
font-size: 12px;
/*
* Always add the bubble
*/
padding: 4px 6px !important;
border-radius: 10px;
&:not(.app-navigation-entry__counter--highlighted) {
background-color: var(--color-background-darker);
.line-one {
display: flex;
align-items: center;
justify-content: space-between;
white-space: nowrap;
margin: 0 auto;
&__title {
overflow: hidden;
flex-grow: 1;
cursor: pointer;
text-overflow: ellipsis;
color: var(--color-main-text);
}
span {
padding: 2px 6px;
&__details {
color: var(--color-text-lighter);
margin: 0 8px;
}
}
.bold {
font-weight: bold;
.line-two {
display: flex;
align-items: flex-start;
justify-content: space-between;
white-space: nowrap;
&__subtitle {
overflow: hidden;
flex-grow: 1;
padding-right: 4px;
cursor: pointer;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--color-text-lighter);
}
&__counter {
margin: 2px 4px 0 0;
}
}
</style>

0 comments on commit a67978b

Please sign in to comment.