-
Notifications
You must be signed in to change notification settings - Fork 3
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 #58 from TNG/demo-banner
Added possibiity to add a demo disclaimer banner
- Loading branch information
Showing
9 changed files
with
86 additions
and
8 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,20 @@ | ||
.banner { | ||
background-color: #dd1e1e; | ||
color: #fff; | ||
font-size: 115%; | ||
font-weight: 900; | ||
left: -8rem; | ||
max-width: 31rem; | ||
min-width: 31rem; | ||
padding: 7rem; | ||
position: fixed; | ||
text-align: center; | ||
top: 14rem; | ||
-webkit-transform: rotate(-45deg); | ||
transform: rotate(-45deg); | ||
-webkit-transform-origin: 0 0; | ||
transform-origin: 0 0; | ||
padding-top: 2.5rem; | ||
padding-bottom: 2rem; | ||
z-index: 999; | ||
} |
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,34 @@ | ||
import '@testing-library/jest-dom'; | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Banner from './banner'; | ||
|
||
describe('Banner', () => { | ||
const envBackup = process.env | ||
|
||
afterEach(() => process.env = envBackup); | ||
|
||
it('should render link if env var is defined', async () => { | ||
// given | ||
process.env.REACT_APP_EOP_BANNER_TEXT = 'This is a banner text' | ||
render(<Banner />); | ||
|
||
// when | ||
const banner = await screen.findByText('This is a banner text'); | ||
|
||
// then | ||
expect(banner).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not render link if env var is not defined', async () => { | ||
// given | ||
process.env.REACT_APP_EOP_BANNER_TEXT = ""; | ||
render(<Banner />); | ||
|
||
// when | ||
const banner = await screen.queryByText('This is a banner text'); | ||
|
||
// then | ||
expect(banner).not.toBeInTheDocument(); | ||
}); | ||
}); |
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,15 @@ | ||
import React from 'react'; | ||
import type { FC } from 'react'; | ||
import './banner.css'; | ||
|
||
|
||
const Banner: FC = () => { | ||
if (process.env.REACT_APP_EOP_BANNER_TEXT) { | ||
return ( | ||
<div className='banner'>{process.env.REACT_APP_EOP_BANNER_TEXT}</div> | ||
); | ||
} | ||
return null; | ||
} | ||
|
||
export default Banner; |
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