This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
-
-
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.
- Loading branch information
1 parent
dcfc90d
commit dad3cd9
Showing
4 changed files
with
106 additions
and
3 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
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,88 @@ | ||
import React from 'react'; | ||
import { | ||
BsFillCheckCircleFill, | ||
BsFillExclamationTriangleFill, | ||
} from 'react-icons/bs'; | ||
import styled from 'styled-components'; | ||
|
||
const StyledAlertContainer = styled.div` | ||
background-color: ${({ error }: { error?: boolean }) => | ||
error ? '#f8ebed' : '#ebf6ed'}; | ||
width: 100%; | ||
height: 40px; | ||
margin: 10px 0px 10px 0px; | ||
border-radius: 4px; | ||
display: flex; | ||
flex-direction: row; | ||
${({ theme }) => theme.mediaQueries.medium} { | ||
height: 50px; | ||
} | ||
${({ theme }) => theme.mediaQueries.small} { | ||
height: 145px; | ||
} | ||
`; | ||
|
||
const Side = styled.div` | ||
min-width: 5px; | ||
max-width: 5px; | ||
height: 100%; | ||
background-color: ${({ error }: { error?: boolean }) => | ||
error ? '#d73847' : '#28a745'}; | ||
border-radius: 4px 0px 0px 4px; | ||
flex: 1; | ||
`; | ||
|
||
const AlertIcon = styled(BsFillExclamationTriangleFill)` | ||
margin: 13px 5px 13px 8px; | ||
color: #d73847; | ||
`; | ||
|
||
const CheckIcon = styled(BsFillCheckCircleFill)` | ||
margin: 13px 5px 13px 8px; | ||
color: #28a745; | ||
`; | ||
|
||
const StyledTitle = styled.p` | ||
margin: 10px 5px; | ||
color: black; | ||
/* Body-LG-Medium */ | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 24px; /* 150% */ | ||
`; | ||
|
||
export enum AlertType { | ||
Success = 'success', | ||
Failure = 'failure', | ||
} | ||
|
||
export const AlertBanner = ({ | ||
title, | ||
alertType, | ||
}: { | ||
title: string; | ||
alertType: AlertType; | ||
}) => { | ||
const icon = () => { | ||
switch (alertType) { | ||
case AlertType.Failure: | ||
return <AlertIcon />; | ||
case AlertType.Success: | ||
return <CheckIcon />; | ||
default: | ||
return null; | ||
} | ||
}; | ||
|
||
return ( | ||
<StyledAlertContainer error={alertType === AlertType.Failure}> | ||
<Side error={alertType === AlertType.Failure} /> | ||
{icon()} | ||
<StyledTitle>{title}</StyledTitle> | ||
</StyledAlertContainer> | ||
); | ||
}; |
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