fix mobile buttons

This commit is contained in:
hay-kot 2021-05-05 12:07:35 -08:00
commit 606e7dbb6e
3 changed files with 15 additions and 3 deletions

View file

@ -8,7 +8,7 @@
<v-list-item-title class=" mb-1">{{ name }} </v-list-item-title> <v-list-item-title class=" mb-1">{{ name }} </v-list-item-title>
<v-list-item-subtitle> {{ description }} </v-list-item-subtitle> <v-list-item-subtitle> {{ description }} </v-list-item-subtitle>
<div class="d-flex justify-center align-center"> <div class="d-flex justify-center align-center">
<RecipeChips :items="tags" :title="false" :limit="1" :small="true" :isCategory="false" /> <RecipeChips :truncate="true" :items="tags" :title="false" :limit="1" :small="true" :isCategory="false" />
<v-rating <v-rating
color="secondary" color="secondary"
class="ml-auto" class="ml-auto"

View file

@ -25,7 +25,7 @@
<v-card-actions> <v-card-actions>
<Rating :value="rating" :name="name" :slug="slug" :small="true" /> <Rating :value="rating" :name="name" :slug="slug" :small="true" />
<v-spacer></v-spacer> <v-spacer></v-spacer>
<RecipeChips :items="tags" :title="false" :limit="2" :small="true" :isCategory="false" /> <RecipeChips :truncate="true" :items="tags" :title="false" :limit="2" :small="true" :isCategory="false" />
<ContextMenu :slug="slug" /> <ContextMenu :slug="slug" />
</v-card-actions> </v-card-actions>
</v-card> </v-card>

View file

@ -11,7 +11,7 @@
:to="`/recipes/${urlParam}/${getSlug(category)}`" :to="`/recipes/${urlParam}/${getSlug(category)}`"
:key="category" :key="category"
> >
{{ category }} {{ truncateText(category) }}
</v-chip> </v-chip>
</div> </div>
</template> </template>
@ -19,6 +19,9 @@
<script> <script>
export default { export default {
props: { props: {
truncate: {
default: false,
},
items: { items: {
default: [], default: [],
}, },
@ -34,6 +37,7 @@ export default {
small: { small: {
default: false, default: false,
}, },
maxWidth: {},
}, },
computed: { computed: {
allCategories() { allCategories() {
@ -58,6 +62,14 @@ export default {
if (matches.length > 0) return matches[0].slug; if (matches.length > 0) return matches[0].slug;
} }
}, },
truncateText(text, length = 20, clamp) {
if (!this.truncate) return text;
clamp = clamp || "...";
var node = document.createElement("div");
node.innerHTML = text;
var content = node.textContent;
return content.length > length ? content.slice(0, length) + clamp : content;
},
}, },
}; };
</script> </script>