Skip to content

Commit 6c4f013

Browse files
committed
fix(ratings): fix css responsive flow on screen <= 725px
1 parent 03d2920 commit 6c4f013

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

src/components/views/panel/PanelRating.vue

+8-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const props = defineProps({
4444
4545
const i18n = useI18n('panel', 'ratings');
4646
47-
const { votes, rating, score } = toRefs(props);
47+
const { votes, rating } = toRefs(props);
4848
4949
const votesUnit = computed(() => {
5050
if (votes?.value === undefined) return undefined;
@@ -121,17 +121,19 @@ const _rating = computed(() => (rating?.value ?? 0) * 10);
121121
.rating-container {
122122
--duration: 1000ms;
123123
124-
flex: 1 1 auto;
125-
min-width: 6rem;
126-
padding: 0.5rem;
124+
flex: 1 0 6rem;
127125
128126
.rating-skeleton {
129127
width: 2.125rem;
130128
margin-top: 0.5rem;
131129
}
132130
133-
@media (width <= 640px) {
134-
padding: 0.5rem 25%;
131+
@media (width <= 725px) {
132+
padding: 0.5rem 10%;
133+
}
134+
135+
@media (width <= 500px) {
136+
padding: 0.5rem;
135137
}
136138
}
137139
</style>

src/components/views/panel/PanelScore.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ const containerRef = ref<InstanceType<typeof TextField>>();
106106
.score-container {
107107
--duration: 1000ms;
108108
109-
flex: 1 1 auto;
110-
min-width: 6rem;
111-
padding: 0.5rem;
109+
flex: 1 0 6rem;
112110
113111
.score-label {
114112
align-self: center;
@@ -124,8 +122,12 @@ const containerRef = ref<InstanceType<typeof TextField>>();
124122
margin-top: 0.5rem;
125123
}
126124
127-
@media (width <= 640px) {
128-
padding: 0.5rem 25%;
125+
@media (width <= 725px) {
126+
padding: 0.5rem 10%;
127+
}
128+
129+
@media (width <= 500px) {
130+
padding: 0.5rem;
129131
}
130132
}
131133
</style>

src/components/views/panel/PanelStatistics.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { TraktSyncRatingValue } from '@dvcol/trakt-http-client/models';
66
import PanelRating from '~/components/views/panel/PanelRating.vue';
77
import PanelScore from '~/components/views/panel/PanelScore.vue';
88
import { useExtensionSettingsStoreRefs } from '~/stores/settings/extension.store';
9+
import { watchMedia } from '~/utils/window.utils';
910
1011
defineProps({
1112
rating: {
@@ -41,18 +42,21 @@ const emit = defineEmits<{
4142
const { enableRatings } = useExtensionSettingsStoreRefs();
4243
4344
const onScoreEdit = (progress: TraktSyncRatingValue) => emit('onScoreEdit', progress);
45+
46+
const isCompact = watchMedia('(max-width: 725px)');
4447
</script>
4548

4649
<template>
4750
<NFlex class="statistics-container" justify="space-around">
51+
<slot v-if="isCompact" />
4852
<PanelRating
4953
v-if="enableRatings"
5054
:loading="loadingRating"
5155
:votes="votes"
5256
:rating="rating"
5357
:url="url"
5458
/>
55-
<slot />
59+
<slot v-if="!isCompact" />
5660
<PanelScore
5761
v-if="enableRatings"
5862
:loading="loadingScore"

0 commit comments

Comments
 (0)