Skip to content

Commit e932d66

Browse files
committed
Always use a 1:1 aspect ratio for avatars
1 parent 86961b7 commit e932d66

File tree

1 file changed

+47
-9
lines changed

1 file changed

+47
-9
lines changed

dotcom-rendering/src/components/Avatar.tsx

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,65 @@ const decideImageWidths = (
6464
): [ImageWidthType, ...ImageWidthType[]] => {
6565
switch (imageSize) {
6666
case 'small':
67-
return [{ breakpoint: breakpoints.mobile, width: 80 }];
67+
return [
68+
{
69+
breakpoint: breakpoints.mobile,
70+
width: 80,
71+
aspectRatio: '1:1',
72+
},
73+
];
6874

6975
case 'medium':
7076
default:
7177
return [
72-
{ breakpoint: breakpoints.mobile, width: 80 },
73-
{ breakpoint: breakpoints.desktop, width: 90 },
78+
{
79+
breakpoint: breakpoints.mobile,
80+
width: 80,
81+
aspectRatio: '1:1',
82+
},
83+
{
84+
breakpoint: breakpoints.desktop,
85+
width: 90,
86+
aspectRatio: '1:1',
87+
},
7488
];
7589

7690
case 'large':
7791
return [
78-
{ breakpoint: breakpoints.mobile, width: 150 },
79-
{ breakpoint: breakpoints.tablet, width: 130 },
80-
{ breakpoint: breakpoints.desktop, width: 150 },
92+
{
93+
breakpoint: breakpoints.mobile,
94+
width: 150,
95+
aspectRatio: '1:1',
96+
},
97+
{
98+
breakpoint: breakpoints.tablet,
99+
width: 130,
100+
aspectRatio: '1:1',
101+
},
102+
{
103+
breakpoint: breakpoints.desktop,
104+
width: 150,
105+
aspectRatio: '1:1',
106+
},
81107
];
82108

83109
case 'jumbo':
84110
return [
85-
{ breakpoint: breakpoints.mobile, width: 180 },
86-
{ breakpoint: breakpoints.tablet, width: 160 },
87-
{ breakpoint: breakpoints.desktop, width: 190 },
111+
{
112+
breakpoint: breakpoints.mobile,
113+
width: 180,
114+
aspectRatio: '1:1',
115+
},
116+
{
117+
breakpoint: breakpoints.tablet,
118+
width: 160,
119+
aspectRatio: '1:1',
120+
},
121+
{
122+
breakpoint: breakpoints.desktop,
123+
width: 190,
124+
aspectRatio: '1:1',
125+
},
88126
];
89127
/* Avatars on cards in the highlights container are fixed to 98px on all breakpoints */
90128
case 'highlights-card':

0 commit comments

Comments
 (0)