Skip to content

Commit 1c1d6e2

Browse files
style(toolbar): adjust alert indicator css (#76189)
- relates to #75636 - new styling for the alert badge -- no count, just a red dot (see [figma](https://www.figma.com/design/G8sBIfdPBh7wwpKdEMjqcD/Specs%3A-Dev-Toolbar-v2?node-id=2087-3091&t=KlTCSSkhLqDtjp8y-0)) before: <img width="38" alt="SCR-20240814-jyjf" src="https://github.com/user-attachments/assets/29a76783-0d12-4c4c-a985-ea079a603088"> after: <img width="47" alt="SCR-20240814-jyfs" src="https://github.com/user-attachments/assets/50ae6ef2-1441-4fee-a756-a0daff375fb6">
1 parent f236351 commit 1c1d6e2

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import IndicatorBadge from 'sentry/components/devtoolbar/components/indicatorBadge';
2+
3+
import useAlertsCount from './useAlertsCount';
4+
5+
export default function AlertBadge() {
6+
const {data: count} = useAlertsCount();
7+
8+
if (count === undefined || count < 1) {
9+
return null;
10+
}
11+
return <IndicatorBadge variant="red" />;
12+
}

static/app/components/devtoolbar/components/alerts/alertCountBadge.tsx

-12
This file was deleted.

static/app/components/devtoolbar/components/indicatorBadge.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type React from 'react';
21
import {css} from '@emotion/react';
32

43
import {smallCss} from '../styles/typography';
@@ -11,26 +10,25 @@ const variants = {
1110
};
1211

1312
interface Props {
14-
icon: React.ReactNode;
1513
variant: keyof typeof variants;
1614
}
1715

18-
export default function IndicatorBadge({icon, variant}: Props) {
19-
return <div css={[smallCss, counterCss, variants[variant]]}>{icon}</div>;
16+
export default function IndicatorBadge({variant}: Props) {
17+
return <div css={[smallCss, badgeCss, variants[variant]]} />;
2018
}
2119

22-
const counterCss = css`
20+
const badgeCss = css`
2321
background: var(--red400);
2422
border-radius: 50%;
2523
border: 1px solid transparent;
2624
box-sizing: content-box;
2725
color: var(--gray100);
28-
height: 1rem;
26+
height: 0.55rem;
2927
line-height: 1rem;
3028
position: absolute;
31-
right: -6px;
32-
top: -6px;
33-
width: 1rem;
29+
right: 2px;
30+
top: 18px;
31+
width: 0.55rem;
3432
display: flex;
3533
align-items: center;
3634
justify-content: center;

static/app/components/devtoolbar/components/navigation.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import useToolbarRoute from '../hooks/useToolbarRoute';
1818
import {navigationCss} from '../styles/navigation';
1919
import {resetDialogCss} from '../styles/reset';
2020

21-
import AlertCountBadge from './alerts/alertCountBadge';
21+
import AlertBadge from './alerts/alertBadge';
2222
import IconButton from './navigation/iconButton';
2323

2424
export default function Navigation({
@@ -55,7 +55,7 @@ export default function Navigation({
5555
<NavButton panelName="issues" label="Issues" icon={<IconIssues />} />
5656
<NavButton panelName="feedback" label="User Feedback" icon={<IconMegaphone />} />
5757
<NavButton panelName="alerts" label="Active Alerts" icon={<IconSiren />}>
58-
<AlertCountBadge />
58+
<AlertBadge />
5959
</NavButton>
6060
<NavButton panelName="featureFlags" label="Feature Flags" icon={<IconFlag />} />
6161
<NavButton panelName="releases" label="Releases" icon={<IconReleases />}>

static/app/components/devtoolbar/components/releases/sessionStatusBadge.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import IndicatorBadge from 'sentry/components/devtoolbar/components/indicatorBadge';
22
import useSessionStatus from 'sentry/components/devtoolbar/components/releases/useSessionStatus';
3-
import {IconFire} from 'sentry/icons';
43

54
export default function CrashCountBadge() {
65
const {data} = useSessionStatus();
@@ -18,7 +17,7 @@ export default function CrashCountBadge() {
1817

1918
// over 10% of sessions were crashes
2019
if (crashPercent > 10) {
21-
return <IndicatorBadge icon={<IconFire size="xs" />} variant="red" />;
20+
return <IndicatorBadge variant="red" />;
2221
}
2322
return null;
2423
}

0 commit comments

Comments
 (0)