Skip to content

Commit 0f8b16a

Browse files
authored
Merge pull request #826 from amitamrutiya/update-performer
enhance PerformersSection, StatCardProps and improve icon click…
2 parents 30fd40e + 940494d commit 0f8b16a

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/custom/PerformersSection/PerformersSection.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ interface BaseQueryParams {
4848

4949
interface StatCardProps {
5050
label: string;
51+
countKey: string;
5152
count: number;
5253
patternName: string;
5354
pattern: Pattern;
@@ -57,7 +58,7 @@ interface StatCardProps {
5758
status: string;
5859
id: string;
5960
onCardClick: (pattern: Pattern) => void;
60-
onIconClick: () => void;
61+
onIconClick: (sortOrder: string) => void;
6162
onAuthorClick: (userId: string) => void;
6263
onStatusClick: (status: string) => void;
6364
}
@@ -121,6 +122,7 @@ const createQueryParams = (metric: MetricType): BaseQueryParams => ({
121122

122123
const StatCardComponent: React.FC<StatCardProps> = ({
123124
label,
125+
countKey,
124126
count,
125127
patternName,
126128
pattern,
@@ -138,9 +140,9 @@ const StatCardComponent: React.FC<StatCardProps> = ({
138140
onCardClick(pattern);
139141
};
140142

141-
const handleIconClick = (e: React.MouseEvent) => {
143+
const handleIconClick = (e: React.MouseEvent, sortOrder: string) => {
142144
e.stopPropagation();
143-
onIconClick();
145+
onIconClick(sortOrder);
144146
};
145147

146148
const handleAuthorClick = (e: React.MouseEvent) => {
@@ -157,10 +159,10 @@ const StatCardComponent: React.FC<StatCardProps> = ({
157159
<StyledCard elevation={0} status={status} onClick={handleCardClick}>
158160
<ContentWrapper cardId={id}>
159161
<HeaderSection>
160-
<HeaderTitle>{label}</HeaderTitle>
161-
<IconContainer onClick={handleIconClick}>
162+
<IconContainer onClick={(e) => handleIconClick(e, `${countKey}+desc`)}>
162163
<Icon className={id} />
163164
</IconContainer>
165+
<HeaderTitle>{label}</HeaderTitle>
164166
</HeaderSection>
165167

166168
<StatsValue>{count}</StatsValue>
@@ -238,6 +240,7 @@ const processQueryData = (
238240

239241
return {
240242
label: config.label,
243+
countKey: config.countKey,
241244
count: pattern[config.countKey],
242245
patternName: pattern.name || 'Unknown',
243246
pattern: pattern,

src/custom/PerformersSection/styles.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,21 @@ export const IconContainer = styled(Box)(() => ({
137137
}
138138
}));
139139

140-
export const ContentWrapper = styled(CardContent)<ContentWrapperProps>(({ cardId, theme }) => ({
140+
export const ContentWrapper = styled(CardContent)<ContentWrapperProps>(() => ({
141141
height: '100%',
142142
display: 'flex',
143143
flexDirection: 'column',
144-
padding: theme.spacing(2),
145-
paddingInline: cardId === 'download-icon' ? '12px' : theme.spacing(2),
144+
padding: '12px',
146145
'&:last-child': {
147-
paddingBottom: theme.spacing(2)
146+
paddingBottom: '12px'
148147
}
149148
}));
150149

151150
export const HeaderSection = styled(Box)({
152151
display: 'flex',
153152
justifyContent: 'space-between',
154153
alignItems: 'flex-start',
155-
marginBottom: '1rem',
154+
marginBottom: '0.5rem',
156155
gap: '0.6rem'
157156
});
158157

@@ -163,7 +162,14 @@ export const HeaderTitle = styled(Typography)(({ theme }) => ({
163162
lineHeight: 1.2,
164163
marginTop: '4px',
165164
textTransform: 'uppercase',
166-
letterSpacing: '0.5px'
165+
letterSpacing: '0.5px',
166+
display: '-webkit-box',
167+
WebkitLineClamp: 2,
168+
WebkitBoxOrient: 'vertical',
169+
overflow: 'hidden',
170+
textOverflow: 'clip',
171+
maxWidth: '70%',
172+
height: '2.4em'
167173
}));
168174

169175
export const StatsValue = styled(Typography)(({ theme }) => ({

0 commit comments

Comments
 (0)