Skip to content

Commit 06d2c71

Browse files
committed
chore: tweaks notices icon color, storybook and spacing
1 parent 7b4d0d3 commit 06d2c71

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

frontend/amundsen_application/static/js/components/Alert/alert.story.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,43 @@ import { NoticeSeverity } from 'config/config-types';
1010
import StorySection from '../StorySection';
1111
import Alert from '.';
1212

13+
const ALERT_CONTAINER_WIDTH = 425;
14+
1315
export const AlertStory = (): React.ReactNode => (
1416
<>
15-
<StorySection title="Alert">
17+
<StorySection title="Alert" width={ALERT_CONTAINER_WIDTH}>
1618
<Alert
1719
message="Alert text that can be short"
1820
onAction={() => {
1921
alert('action executed!');
2022
}}
2123
/>
2224
</StorySection>
23-
<StorySection title="Alert with long text">
24-
<Alert message="Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam perspiciatis non ipsa officia expedita magnam mollitia, excepturi iste eveniet qui nisi eum illum, quas voluptas, reprehenderit quam molestias cum quisquam!" />
25+
<StorySection title="Alert with long text" width={ALERT_CONTAINER_WIDTH}>
26+
<Alert message="Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam perspiciatis non ipsa officia expedita magnam mollitia, excepturi iste eveniet qui nisi eum illum!" />
27+
</StorySection>
28+
<StorySection
29+
title="Alert with medium long text and action"
30+
width={ALERT_CONTAINER_WIDTH}
31+
>
32+
<Alert
33+
actionText="Action Text"
34+
onAction={() => {
35+
alert('action executed!');
36+
}}
37+
message="Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam perspiciatis"
38+
/>
2539
</StorySection>
26-
<StorySection title="Alert with long text and action">
40+
<StorySection
41+
title="Alert with long text and action"
42+
width={ALERT_CONTAINER_WIDTH}
43+
>
2744
<Alert
2845
actionText="Action Text"
2946
onAction={() => {
3047
alert('action executed!');
3148
}}
32-
message="Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam perspiciatis non ipsa officia expedita magnam mollitia, excepturi iste eveniet qui nisi eum illum, quas voluptas, reprehenderit quam molestias cum quisquam!"
49+
message="Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam perspiciatis non ipsa officia expedita magnam mollitia, excepturi iste eveniet qui nisi eum illum!"
3350
/>
3451
</StorySection>
3552
</>

frontend/amundsen_application/static/js/components/Alert/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import './styles.scss';
1414

1515
const SEVERITY_TO_COLOR_MAP = {
1616
[NoticeSeverity.INFO]: '#3a97d3', // cyan50
17-
[NoticeSeverity.WARNING]: '#ffb146', // $amber50
17+
[NoticeSeverity.WARNING]: '#FF8D1F', // $amber70
1818
[NoticeSeverity.ALERT]: '#b8072c', // $red70
1919
};
2020
const SEVERITY_TO_SEVERITY_CLASS = {
@@ -26,6 +26,8 @@ const OPEN_PAYLOAD_CTA = 'See details';
2626
const PAYLOAD_MODAL_TITLE = 'Summary';
2727
const PAYLOAD_MODAL_CLOSE_BTN = 'Close';
2828

29+
const DEFINITION_WIDTH = 150;
30+
2931
export interface AlertProps {
3032
/** Message to show in the alert */
3133
message: string | React.ReactNode;
@@ -139,7 +141,10 @@ const Alert: React.FC<AlertProps> = ({
139141
<Modal.Title>{PAYLOAD_MODAL_TITLE}</Modal.Title>
140142
</Modal.Header>
141143
<Modal.Body>
142-
<DefinitionList definitions={payloadDefinitions} termWidth={120} />
144+
<DefinitionList
145+
definitions={payloadDefinitions}
146+
termWidth={DEFINITION_WIDTH}
147+
/>
143148
</Modal.Body>
144149
<Modal.Footer>
145150
<button

frontend/amundsen_application/static/js/components/Alert/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $alert-alert-background: #ffe4dd;
1212
.alert {
1313
border-radius: $alert-border-radius;
1414
display: flex;
15-
padding: $spacer-1 $spacer-1 * 1.5 $spacer-1 $spacer-2;
15+
padding: $spacer-1 $spacer-1 $spacer-1 $spacer-2;
1616
justify-content: flex-start;
1717
box-shadow: $elevation-level2;
1818

@@ -37,7 +37,7 @@ $alert-alert-background: #ffe4dd;
3737
.info-svg-icon {
3838
flex-shrink: 0;
3939
align-self: center;
40-
margin-right: $spacer-1;
40+
margin-right: $spacer-2;
4141
}
4242

4343
.alert-action {

frontend/amundsen_application/static/js/components/StorySection/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33

44
import * as React from 'react';
55

6+
const DEFAULT_WIDTH = 600;
7+
68
export type BlockProps = {
79
children: React.ReactNode;
810
title: string;
911
text?: string | React.ReactNode;
12+
width?: number;
1013
};
1114

1215
const StorySection: React.FC<BlockProps> = ({
1316
children,
1417
text,
1518
title,
19+
width = DEFAULT_WIDTH,
1620
}: BlockProps) => (
1721
<div
1822
className="story-section"
19-
style={{ padding: '2em 2em 1em', maxWidth: 600 }}
23+
style={{ padding: '2em 2em 1em', maxWidth: width }}
2024
>
2125
<h1 className="text-headline-w1">{title}</h1>
2226
{text && <p className="text-body-w1">{text}</p>}

0 commit comments

Comments
 (0)