+
+
-
-
{title}
- {children &&
{children}
}
+
+
{title}
+ {children &&
{children}
}
- {/* If onRemove is specified , giving preference to onRemove */}
- {onRemove && (
-
);
};
+
+const getStyles = (theme: GrafanaTheme, severity: AlertVariant, outline: boolean) => {
+ const { redBase, redShade, greenBase, greenShade, blue80, blue77, white } = theme.palette;
+ const backgrounds = {
+ error: css`
+ background: linear-gradient(90deg, ${redBase}, ${redShade});
+ `,
+ warning: css`
+ background: linear-gradient(90deg, ${redBase}, ${redShade});
+ `,
+ info: css`
+ background: linear-gradient(100deg, ${blue80}, ${blue77});
+ `,
+ success: css`
+ background: linear-gradient(100deg, ${greenBase}, ${greenShade});
+ `,
+ };
+
+ return {
+ container: css`
+ z-index: ${theme.zIndex.tooltip};
+ `,
+ alert: css`
+ padding: 15px 20px;
+ margin-bottom: ${theme.spacing.xs};
+ position: relative;
+ color: ${white};
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
+ border-radius: ${theme.border.radius.md};
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ ${backgrounds[severity]}
+ `,
+ icon: css`
+ padding: 0 ${theme.spacing.md} 0 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 35px;
+ `,
+ title: css`
+ font-weight: ${theme.typography.weight.semibold};
+ `,
+ body: css`
+ flex-grow: 1;
+ margin: 0 ${theme.spacing.md} 0 0;
+
+ a {
+ color: ${white};
+ text-decoration: underline;
+ }
+ `,
+ close: css`
+ background: none;
+ display: flex;
+ align-items: center;
+ border: ${outline ? `1px solid ${white}` : 'none'};
+ border-radius: ${theme.border.radius.sm};
+ `,
+ };
+};
diff --git a/packages/grafana-ui/src/components/Alert/_Alert.scss b/packages/grafana-ui/src/components/Alert/_Alert.scss
deleted file mode 100644
index 0d801ebc20b..00000000000
--- a/packages/grafana-ui/src/components/Alert/_Alert.scss
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Alerts
-// --------------------------------------------------
-
-// Base styles
-// -------------------------
-
-.alert {
- padding: 15px 20px;
- margin-bottom: $space-xs;
- text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
- background: $alert-error-bg;
- position: relative;
- color: $white;
- text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
- border-radius: $border-radius;
- display: flex;
- flex-direction: row;
- align-items: center;
-}
-
-// Alternate styles
-// -------------------------
-
-.alert-success {
- background: $alert-success-bg;
-}
-
-.alert-danger,
-.alert-error {
- background: $alert-error-bg;
-}
-
-.alert-info {
- background: $alert-info-bg;
-}
-
-.alert-warning {
- background: $alert-warning-bg;
-}
-
-.alert-container {
- z-index: $zindex-tooltip;
-}
-
-.page-alert-list {
- z-index: 8000;
- min-width: 400px;
- max-width: 600px;
- position: fixed;
- right: 10px;
- top: 60px;
-}
-
-.alert-close {
- padding: 0 0 0 $space-md;
- border: none;
- background: none;
- display: flex;
- align-items: center;
-
- .fa {
- align-self: flex-end;
- font-size: 21px;
- color: rgba(255, 255, 255, 0.75);
- }
-}
-
-.alert-title {
- font-weight: $font-weight-semi-bold;
-}
-
-.alert-icon {
- padding: 0 $space-md 0 0;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 35px;
- .fa {
- font-size: 21px;
- }
-}
-
-.alert-body {
- flex-grow: 1;
-
- a {
- color: $white;
- text-decoration: underline;
- }
-}
-
-.alert-icon-on-top {
- align-items: flex-start;
-}
diff --git a/packages/grafana-ui/src/components/index.scss b/packages/grafana-ui/src/components/index.scss
index ab8dd512e2f..4f8a24b7bd9 100644
--- a/packages/grafana-ui/src/components/index.scss
+++ b/packages/grafana-ui/src/components/index.scss
@@ -12,5 +12,4 @@
@import 'TableInputCSV/TableInputCSV';
@import 'TimePicker/TimeOfDayPicker';
@import 'Tooltip/Tooltip';
-@import 'Alert/Alert';
@import 'Slider/Slider';