diff --git a/amundsen_application/static/js/components/common/Alert/AlertIcon.tsx b/amundsen_application/static/js/components/common/Alert/AlertIcon.tsx new file mode 100644 index 000000000..e30d07b90 --- /dev/null +++ b/amundsen_application/static/js/components/common/Alert/AlertIcon.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; + +const STROKE_COLOR = '#b8072c'; // $red70 +const SIZE = 16; + +const AlertIcon: React.FC = () => { + return ( + + + + ); +}; + +export default AlertIcon; diff --git a/amundsen_application/static/js/components/common/Alert/alert.story.tsx b/amundsen_application/static/js/components/common/Alert/alert.story.tsx index d5448a3f2..450017f3d 100644 --- a/amundsen_application/static/js/components/common/Alert/alert.story.tsx +++ b/amundsen_application/static/js/components/common/Alert/alert.story.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { ImageIconType } from 'interfaces/Enums'; import StorySection from '../StorySection'; import Alert from '.'; @@ -13,17 +12,38 @@ stories.add('Alert', () => ( { - alert('message closed!'); + alert('action executed!'); }} /> + + + Alert text that has a link + + } + /> + { - alert('message closed!'); + alert('action executed!'); + }} + /> + + + + + + { + alert('action executed!'); }} + 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!" /> diff --git a/amundsen_application/static/js/components/common/Alert/index.spec.tsx b/amundsen_application/static/js/components/common/Alert/index.spec.tsx index 3a9210e22..7ab8375b9 100644 --- a/amundsen_application/static/js/components/common/Alert/index.spec.tsx +++ b/amundsen_application/static/js/components/common/Alert/index.spec.tsx @@ -4,7 +4,6 @@ import * as React from 'react'; import { mount } from 'enzyme'; -import { ImageIconType } from 'interfaces/Enums'; import Alert, { AlertProps } from '.'; const setup = (propOverrides?: Partial) => { @@ -23,7 +22,7 @@ describe('Alert', () => { it('should render an alert icon', () => { const { wrapper } = setup(); const expected = 1; - const actual = wrapper.find(`.${ImageIconType.ALERT}`).length; + const actual = wrapper.find('.alert-triangle-svg-icon').length; expect(actual).toEqual(expected); }); diff --git a/amundsen_application/static/js/components/common/Alert/index.tsx b/amundsen_application/static/js/components/common/Alert/index.tsx index 39908a4f5..3811abae1 100644 --- a/amundsen_application/static/js/components/common/Alert/index.tsx +++ b/amundsen_application/static/js/components/common/Alert/index.tsx @@ -3,14 +3,14 @@ import * as React from 'react'; -import { ImageIconType } from 'interfaces/Enums'; +import AlertIcon from './AlertIcon'; import './styles.scss'; export interface AlertProps { - message: string; + message: string | React.ReactNode; actionText?: string; - onAction: (event: React.MouseEvent) => void; + onAction?: (event: React.MouseEvent) => void; } const Alert: React.FC = ({ @@ -21,7 +21,7 @@ const Alert: React.FC = ({ return (
- +

{message}

{actionText && onAction && ( diff --git a/amundsen_application/static/js/components/common/Alert/styles.scss b/amundsen_application/static/js/components/common/Alert/styles.scss index 1ef864cd8..32b3395fb 100644 --- a/amundsen_application/static/js/components/common/Alert/styles.scss +++ b/amundsen_application/static/js/components/common/Alert/styles.scss @@ -4,33 +4,30 @@ @import 'variables'; @import 'typography'; -$alert-height: 56px; $alert-border-radius: 4px; $alert-message-line-height: 24px; .alert { - background-color: $body-bg-dark; + background-color: $body-bg; border-radius: $alert-border-radius; - color: $white; display: flex; - height: $alert-height; - padding: $spacer-2; - padding-right: $spacer-1 * 1.5; + padding: $spacer-1 $spacer-1 * 1.5 $spacer-1 $spacer-2; justify-content: space-between; + box-shadow: $elevation-level2; - .message { - @extend %text-body-w3; + .alert-message { + @extend %text-body-w2; - line-height: $alert-message-line-height; + // line-height: $alert-message-line-height; margin: 0; display: inline; } - .icon { - margin: 0 $spacer-1 0 0; + .alert-triangle-svg-icon { + margin: 0 $spacer-1 -2px 0; } - .btn-close { + .btn-link { margin: auto 0 auto $spacer-3; } } diff --git a/amundsen_application/static/js/components/common/StorySection/index.tsx b/amundsen_application/static/js/components/common/StorySection/index.tsx index 516445dbf..430a99694 100644 --- a/amundsen_application/static/js/components/common/StorySection/index.tsx +++ b/amundsen_application/static/js/components/common/StorySection/index.tsx @@ -11,10 +11,10 @@ const StorySection: React.FC = ({ text, title, }: BlockProps) => ( -
+

{title}

{text &&

{text}

} - {children} +
{children}
);