perf: use OptimizedImage in ProductPage
This commit is contained in:
@@ -25,6 +25,7 @@ import { formatPriceRub } from '@/shared/lib/format-price'
|
|||||||
import { reviewsCountRu } from '@/shared/lib/reviews-count-ru'
|
import { reviewsCountRu } from '@/shared/lib/reviews-count-ru'
|
||||||
import { $user } from '@/shared/model/auth'
|
import { $user } from '@/shared/model/auth'
|
||||||
import { RichTextMessageContent } from '@/shared/ui/RichTextMessageContent'
|
import { RichTextMessageContent } from '@/shared/ui/RichTextMessageContent'
|
||||||
|
import { OptimizedImage } from '@/shared/ui/OptimizedImage'
|
||||||
|
|
||||||
export function ProductPage() {
|
export function ProductPage() {
|
||||||
const user = useUnit($user)
|
const user = useUnit($user)
|
||||||
@@ -91,9 +92,6 @@ export function ProductPage() {
|
|||||||
{imageUrls.map((url, idx) => (
|
{imageUrls.map((url, idx) => (
|
||||||
<SwiperSlide key={url}>
|
<SwiperSlide key={url}>
|
||||||
<Box
|
<Box
|
||||||
component="img"
|
|
||||||
src={url}
|
|
||||||
alt={p.title}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setViewerIndex(idx)
|
setViewerIndex(idx)
|
||||||
setViewerOpen(true)
|
setViewerOpen(true)
|
||||||
@@ -101,12 +99,21 @@ export function ProductPage() {
|
|||||||
sx={{
|
sx={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 420,
|
height: 420,
|
||||||
objectFit: 'cover',
|
|
||||||
display: 'block',
|
|
||||||
cursor: 'zoom-in',
|
cursor: 'zoom-in',
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
<OptimizedImage
|
||||||
|
src={url}
|
||||||
|
alt={p.title}
|
||||||
|
sizes="(max-width: 600px) 320px, (max-width: 1024px) 640px, 1024px"
|
||||||
|
sx={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
objectFit: 'cover',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
))}
|
))}
|
||||||
</Swiper>
|
</Swiper>
|
||||||
@@ -219,18 +226,27 @@ export function ProductPage() {
|
|||||||
)}
|
)}
|
||||||
{rv.imageUrl && (
|
{rv.imageUrl && (
|
||||||
<Box
|
<Box
|
||||||
component="img"
|
|
||||||
src={rv.imageUrl}
|
|
||||||
alt="Фото к отзыву"
|
|
||||||
sx={{
|
sx={{
|
||||||
width: 140,
|
width: 140,
|
||||||
height: 140,
|
height: 140,
|
||||||
objectFit: 'cover',
|
|
||||||
borderRadius: 1.5,
|
borderRadius: 1.5,
|
||||||
border: 1,
|
border: 1,
|
||||||
borderColor: 'divider',
|
borderColor: 'divider',
|
||||||
|
overflow: 'hidden',
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
<OptimizedImage
|
||||||
|
src={rv.imageUrl}
|
||||||
|
alt="Фото к отзыву"
|
||||||
|
widths={[140, 320]}
|
||||||
|
sizes="140px"
|
||||||
|
sx={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
objectFit: 'cover',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|||||||
Reference in New Issue
Block a user