-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from uselagoon/variable_error_handling
Adds error alert for Variables tabs
- Loading branch information
Showing
6 changed files
with
159 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import styled, { css } from 'styled-components'; | ||
import { color } from "lib/variables"; | ||
|
||
const sharedStyles = css` | ||
position: relative; | ||
padding: 1rem; | ||
margin-bottom: 2rem; | ||
border-radius: 0.25rem; | ||
display: flex; | ||
justify-content: space-between; | ||
`; | ||
|
||
export const StyledAlert = styled.div` | ||
border-radius: 0.25rem; | ||
&.error { | ||
color: ${color.white}; | ||
background-color: #d68100; | ||
.anticon-close-circle { | ||
margin-right: 4px; | ||
vertical-align: text-top; | ||
} | ||
} | ||
.closebtn { | ||
margin: 4px 8px 0 0; | ||
color: white; | ||
font-weight: bold; | ||
float: right; | ||
font-size: 22px; | ||
line-height: 20px; | ||
cursor: pointer; | ||
transition: 0.3s; | ||
cursor: pointer; | ||
&.closebtn:hover { | ||
color: black; | ||
} | ||
} | ||
`; | ||
|
||
export const StyledAlertContent = styled.div` | ||
${sharedStyles} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
import {StyledAlert, StyledAlertContent} from './StyledAlert'; | ||
|
||
export const Alert = ({ | ||
type, header, message, closeAlert | ||
}) => { | ||
const createClassName = () => { | ||
let className = `${type ? `${type} alert-element` : 'alert-element'}`; | ||
return className; | ||
}; | ||
|
||
const AlertElement = | ||
<StyledAlert className={createClassName()}> | ||
<span className="closebtn" onClick={() => closeAlert()}> | ||
× | ||
</span> | ||
<StyledAlertContent> | ||
<span> | ||
<b>{header}</b> {message} | ||
</span> | ||
</StyledAlertContent> | ||
</StyledAlert> | ||
|
||
|
||
|
||
return <>{AlertElement}</>; | ||
} | ||
|
||
export default Alert; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters