Skip to content

Commit 2ca9b7b

Browse files
authored
chore(trace-view-vitals): refactor pill styling (#96477)
- Refactor code for pills in trace view **Before:** <img width="942" height="182" alt="Screenshot 2025-07-25 at 1 46 53 PM" src="https://github.com/user-attachments/assets/4cc4c556-3c1f-4c87-b4f4-cc37844b06db" /> <img width="508" height="143" alt="Screenshot 2025-07-25 at 1 49 43 PM" src="https://github.com/user-attachments/assets/1e59bc89-87a4-449a-a24e-e7180b31b480" /> **After:** <img width="946" height="175" alt="Screenshot 2025-07-25 at 1 46 39 PM" src="https://github.com/user-attachments/assets/a0a23946-e392-4b62-bddc-d98272811bd2" /> <img width="507" height="142" alt="Screenshot 2025-07-25 at 1 49 22 PM" src="https://github.com/user-attachments/assets/108c13b7-650f-42a1-9280-ad5701b84748" />
1 parent 200c45c commit 2ca9b7b

File tree

3 files changed

+18
-43
lines changed

3 files changed

+18
-43
lines changed

static/app/views/performance/newTraceDetails/traceContextVitals.tsx

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -140,74 +140,56 @@ function VitalPill({vital, vitalDetails}: VitalPillProps) {
140140
const acronym = vitalDetails.acronym ?? vitalDetails.name;
141141
return (
142142
<VitalPillContainer>
143-
<Tooltip title={toolTipTitle}>
144-
<VitalPillName status={status}>{`${acronym}`}</VitalPillName>
145-
</Tooltip>
143+
<VitalPillName status={status}>
144+
<Tooltip title={toolTipTitle}>{`${acronym}`}</Tooltip>
145+
</VitalPillName>
146146
<VitalPillValue>{formattedMeterValueText}</VitalPillValue>
147147
</VitalPillContainer>
148148
);
149149
}
150150

151+
const VitalMetersContainer = styled('div')`
152+
display: flex;
153+
align-items: center;
154+
gap: ${space(1)};
155+
`;
156+
151157
const VitalPillContainer = styled('div')`
152158
display: flex;
153-
flex-direction: row;
154-
max-width: 'auto';
155-
height: 28px;
156159
`;
157160

158161
const VitalPillName = styled('div')<{status: PerformanceScore}>`
159162
display: flex;
160163
align-items: center;
161-
position: relative;
162-
width: max-content;
163-
164-
height: 100%;
165-
padding: 0 ${space(1)};
164+
justify-content: center;
166165
border: solid 1px
167166
${p =>
168167
p.status === 'none'
169168
? p.theme.border
170169
: makePerformanceScoreColors(p.theme)[p.status].border};
171170
border-radius: ${p => p.theme.borderRadius} 0 0 ${p => p.theme.borderRadius};
172-
173171
background-color: ${p => makePerformanceScoreColors(p.theme)[p.status].light};
174172
color: ${p => makePerformanceScoreColors(p.theme)[p.status].normal};
175-
176173
font-size: ${p => p.theme.fontSize.sm};
177174
font-weight: ${p => p.theme.fontWeight.bold};
178175
text-decoration: underline;
179176
text-decoration-style: dotted;
180177
text-underline-offset: ${space(0.25)};
181178
text-decoration-thickness: 1px;
182-
183-
cursor: pointer;
179+
padding: 0 ${space(1)};
184180
`;
185181

186182
const VitalPillValue = styled('div')`
187183
display: flex;
188-
flex: 1;
189184
align-items: center;
190-
justify-content: flex-end;
191-
192-
height: 100%;
193-
padding: 0 ${space(0.5)};
185+
justify-content: center;
194186
border: 1px solid ${p => p.theme.border};
195187
border-left: none;
196188
border-radius: 0 ${p => p.theme.borderRadius} ${p => p.theme.borderRadius} 0;
197-
198189
background: ${p => p.theme.background};
199190
color: ${p => p.theme.textColor};
200-
201191
font-size: ${p => p.theme.fontSize.lg};
202-
`;
203-
204-
const VitalMetersContainer = styled('div')`
205-
display: flex;
206-
flex-direction: row;
207-
flex-wrap: wrap;
208-
align-items: baseline;
209-
gap: ${space(1)};
210-
width: 'auto';
192+
padding: 0 ${space(1)};
211193
`;
212194

213195
const SecondaryVitalsCount = styled('span')`

static/app/views/performance/newTraceDetails/traceHeader/meta.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function MetaSection({headingText, bodyText, rightAlignBody}: MetaDataProps) {
2929
return (
3030
<HeaderInfo>
3131
<StyledSectionHeading>{headingText}</StyledSectionHeading>
32-
<SectionBody rightAlign={rightAlignBody}>{bodyText}</SectionBody>
32+
<SectionBody alignment={rightAlignBody}>{bodyText}</SectionBody>
3333
</HeaderInfo>
3434
);
3535
}
@@ -43,9 +43,9 @@ const StyledSectionHeading = styled(SectionHeading)`
4343
margin: 0;
4444
`;
4545

46-
const SectionBody = styled('div')<{rightAlign?: boolean}>`
46+
const SectionBody = styled('div')<{alignment?: boolean}>`
4747
font-size: ${p => p.theme.fontSize.xl};
48-
text-align: ${p => (p.rightAlign ? 'right' : 'left')};
48+
text-align: ${p => (p.alignment ? 'right' : 'left')};
4949
padding: ${space(0.5)} 0;
5050
max-height: 32px;
5151
`;

static/app/views/performance/newTraceDetails/traceTabsAndVitals.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import styled from '@emotion/styled';
33

44
import {Flex} from 'sentry/components/core/layout';
55
import {TabList, Tabs} from 'sentry/components/core/tabs';
6-
import {space} from 'sentry/styles/space';
76
import type {TraceRootEventQueryResults} from 'sentry/views/performance/newTraceDetails/traceApi/useTraceRootEvent';
87
import {TraceContextVitals} from 'sentry/views/performance/newTraceDetails/traceContextVitals';
98
import {TraceHeaderComponents} from 'sentry/views/performance/newTraceDetails/traceHeader/styles';
@@ -92,11 +91,11 @@ export function TraceTabsAndVitals({
9291
return (
9392
<Flex ref={setRef} justify="between">
9493
<Tabs value={currentTab} onChange={onTabChange}>
95-
<StyledTabsList hideBorder variant="floating">
94+
<TabList hideBorder variant="floating">
9695
{tabOptions.map(tab => (
9796
<TabList.Item key={tab.slug}>{tab.label}</TabList.Item>
9897
))}
99-
</StyledTabsList>
98+
</TabList>
10099
</Tabs>
101100
<TraceContextVitals
102101
rootEventResults={rootEventResults}
@@ -110,9 +109,3 @@ export function TraceTabsAndVitals({
110109
const StyledPlaceholder = styled(TraceHeaderComponents.StyledPlaceholder)`
111110
background-color: ${p => p.theme.purple100};
112111
`;
113-
114-
const StyledTabsList = styled(TabList)`
115-
display: flex;
116-
align-items: center;
117-
gap: ${space(1)};
118-
`;

0 commit comments

Comments
 (0)