fix: Truncate long label names in the sidebar (#1309)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
amd-9 2020-10-10 20:10:11 +03:00 committed by GitHub
parent 3bb2d27646
commit 7d409321e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 4 deletions

View file

@ -275,6 +275,7 @@ export default {
id: label.id, id: label.id,
label: label.title, label: label.title,
color: label.color, color: label.color,
truncateLabel: true,
toState: frontendURL( toState: frontendURL(
`accounts/${this.accountId}/label/${label.title}` `accounts/${this.accountId}/label/${label.title}`
), ),

View file

@ -30,7 +30,7 @@
tag="li" tag="li"
:to="child.toState" :to="child.toState"
> >
<a href="#"> <a href="#" :class="computedChildClass(child)">
<div class="wrap"> <div class="wrap">
<i <i
v-if="computedInboxClass(child)" v-if="computedInboxClass(child)"
@ -42,9 +42,13 @@
class="label-color--display" class="label-color--display"
:style="{ backgroundColor: child.color }" :style="{ backgroundColor: child.color }"
/> />
<div
:title="computedChildTitle(child)"
:class="computedChildClass(child)"
>
{{ child.label }} {{ child.label }}
</div> </div>
</div>
</a> </a>
</router-link> </router-link>
</ul> </ul>
@ -52,7 +56,6 @@
</template> </template>
<script> <script>
/* eslint no-console: 0 */
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import router from '../../routes'; import router from '../../routes';
@ -125,6 +128,14 @@ export default {
const classByType = getInboxClassByType(type, phoneNumber); const classByType = getInboxClassByType(type, phoneNumber);
return classByType; return classByType;
}, },
computedChildClass(child) {
if (!child.truncateLabel) return '';
return 'text-truncate';
},
computedChildTitle(child) {
if (!child.truncateLabel) return false;
return child.label;
},
newLinkClick() { newLinkClick() {
router.push({ name: 'settings_inbox_new', params: { page: 'new' } }); router.push({ name: 'settings_inbox_new', params: { page: 'new' } });
}, },
@ -151,6 +162,7 @@ export default {
border-radius: $space-smaller; border-radius: $space-smaller;
height: $space-normal; height: $space-normal;
margin-right: $space-small; margin-right: $space-small;
min-width: $space-normal;
width: $space-normal; width: $space-normal;
} }
</style> </style>