Skip to content

Commit bf90eb3

Browse files
committed
Use smaller profile photo for mobile
1 parent 783c8ef commit bf90eb3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

app/components/ProfilePhoto.tsx

+14-13
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import cloudinary from '~/utils/cloudinary'
33

44
const ID = 'in-roermond.jpg'
55
const VERSION = 1
6-
// approxiamte px value of w-40
7-
const SM_WIDTH_PX = 160
86

97
interface Props {
108
className?: string
@@ -26,30 +24,30 @@ export default function ProfilePhoto({ className }: Props) {
2624
version: VERSION,
2725
transformations: [
2826
{
29-
width: SM_WIDTH_PX,
27+
width: 160,
3028
aspectRatio: '4:5',
3129
crop: 'fill',
3230
gravity: 'face',
3331
format: 'auto',
3432
quality: 'auto',
3533
},
3634
],
37-
})} ${SM_WIDTH_PX}w,
35+
})} ${160}w,
3836
${cloudinary(ID, {
3937
version: VERSION,
4038
transformations: [
4139
{
42-
width: SM_WIDTH_PX * 2,
40+
width: 160 * 2,
4341
aspectRatio: '4:5',
4442
crop: 'fill',
4543
gravity: 'face',
4644
format: 'auto',
4745
quality: 'auto',
4846
},
4947
],
50-
})} ${SM_WIDTH_PX * 2}w
48+
})} ${260 * 2}w
5149
`}
52-
sizes={`${SM_WIDTH_PX}px`}
50+
sizes={`${160}px`}
5351
/>
5452
<img
5553
alt=""
@@ -58,7 +56,7 @@ export default function ProfilePhoto({ className }: Props) {
5856
version: VERSION,
5957
transformations: [
6058
{
61-
width: 450,
59+
width: 160,
6260
aspectRatio: '2:1',
6361
crop: 'fill',
6462
gravity: 'face',
@@ -72,30 +70,33 @@ export default function ProfilePhoto({ className }: Props) {
7270
version: VERSION,
7371
transformations: [
7472
{
75-
width: 450,
73+
width: 360,
7674
aspectRatio: '2:1',
7775
crop: 'fill',
7876
gravity: 'face',
7977
format: 'auto',
8078
quality: 'auto',
8179
},
8280
],
83-
})} 450w,
81+
})}${360}w,
8482
${cloudinary(ID, {
8583
version: VERSION,
8684
transformations: [
8785
{
88-
width: 900,
86+
width: 360 * 2,
8987
aspectRatio: '2:1',
9088
crop: 'fill',
9189
gravity: 'face',
9290
format: 'auto',
9391
quality: 'auto',
9492
},
9593
],
96-
})} 900w
94+
})} ${360 * 2}w
9795
`}
98-
sizes="100vw"
96+
sizes={[
97+
`(min-width: ${import.meta.env.SCREEN_SM}) 160px`,
98+
'min(360px, calc(100vw - var(--page-padding) * 2 - 0.75rem * 2))',
99+
].join(', ')}
99100
/>
100101
</picture>
101102
</div>

0 commit comments

Comments
 (0)