forked from beyondessential/tupaia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2354 env banner (beyondessential#3192)
* add env banner * Update EnvBanner.js * change color * Update EnvBanner.js * add branch to env * add env banner to ui components * add env banner to lesmis, psss and tupaia * move branch name to component
- Loading branch information
Showing
7 changed files
with
59 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd | ||
* | ||
*/ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import GitHubIcon from '@material-ui/icons/GitHub'; | ||
import { FlexCenter } from './Layout'; | ||
|
||
const StyledBanner = styled(FlexCenter)` | ||
background: ${props => props.$color}; | ||
color: white; | ||
font-size: 13px; | ||
font-weight: 500; | ||
padding: 12px; | ||
text-align: center; | ||
.MuiSvgIcon-root { | ||
font-size: 16px; | ||
margin-right: 0.4rem; | ||
} | ||
`; | ||
|
||
export const EnvBanner = ({ color }) => { | ||
const branch = process.env.REACT_APP_BRANCH; | ||
|
||
if (!branch || typeof branch !== 'string' || branch === 'master' || branch === 'main') { | ||
return null; | ||
} | ||
|
||
return ( | ||
<StyledBanner $color={color}> | ||
<GitHubIcon /> | ||
{branch} | ||
</StyledBanner> | ||
); | ||
}; | ||
|
||
EnvBanner.propTypes = { | ||
color: PropTypes.string, | ||
}; | ||
|
||
EnvBanner.defaultProps = { | ||
color: '#f39c12', | ||
}; |
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