Skip to content

Commit

Permalink
Add info banner to alert users of downtime (#421)
Browse files Browse the repository at this point in the history
* feat: add info banner

* test: set CI=false

* chore: set max width

* chore: remove banner-max-width

Co-authored-by: Ian Chen <ian-@gmx.com>
  • Loading branch information
jeantanzj and pregnantboy authored Jun 16, 2020
1 parent 02e64a2 commit 2af8ddb
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 9 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export { default as CredLabelInput } from './cred-label-input'
export { default as Dropdown } from './dropdown'
export { default as BodyWrapper } from './body-wrapper'
export { default as CsvUpload } from './csv-upload'
export { default as InfoBanner } from './info-banner'
21 changes: 21 additions & 0 deletions frontend/src/components/common/info-banner/InfoBanner.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import 'styles/_variables';
@import 'styles/_mixins';
.container {
background-color: $indigo-blue;
height: auto;
padding: 4px $site-padding;
color: white;
text-align: center;
@include flex-horizontal;
justify-content: center;

.infoText {
max-width: $header-max-width;
font-size: 0.8rem;
}

@include mobile() {
padding: 4px $mobile-site-padding;
text-align: justify;
}
}
18 changes: 18 additions & 0 deletions frontend/src/components/common/info-banner/InfoBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'

import styles from './InfoBanner.module.scss'

const InfoBanner = (props: any) => {
const { children } = props
if (!children) {
return null
}

return (
<div className={styles.container}>
<span className={styles.infoText}>{children}</span>
</div>
)
}

export default InfoBanner
1 change: 1 addition & 0 deletions frontend/src/components/common/info-banner/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './InfoBanner'
5 changes: 4 additions & 1 deletion frontend/src/components/landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import {
PRIVACY_URL,
TC_URL,
REPORT_BUG_URL,
INFO_BANNER,
} from 'config'
import PrimaryButton from 'components/common/primary-button'

import Navbar from './nav-bar'
import Banner from './banner'
import { InfoBanner, PrimaryButton } from 'components/common'
import { AuthContext } from 'contexts/auth.context'
import { getLandingStats } from 'services/stats.service'

Expand Down Expand Up @@ -150,6 +152,7 @@ const Landing = () => {
return (
<div className={styles.landing}>
<Banner></Banner>
<InfoBanner>{INFO_BANNER}</InfoBanner>
<div className={styles.topContainer}>
<Navbar></Navbar>
<div className={styles.innerContainer}>
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/components/landing/banner/Banner.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
font-style: normal;
}

$banner-max-width: 1400px;

.container {
background-color: #f0f0f0;
height: auto;
Expand All @@ -24,7 +22,7 @@ $banner-max-width: 1400px;
a {
@include flex-horizontal;
width: 100%;
max-width: $banner-max-width;
max-width: $header-max-width;
margin: 0 auto;
align-items: center;
color: #484848;
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { Redirect } from 'react-router-dom'
import { OutboundLink } from 'react-ga'

import LoginInput from './login-input'
import { GUIDE_URL, CONTACT_US_URL } from 'config'
import { GUIDE_URL, CONTACT_US_URL, INFO_BANNER } from 'config'
import { AuthContext } from 'contexts/auth.context'

import { InfoBanner } from 'components/common'
import styles from './Login.module.scss'
import loginImg from 'assets/img/landing/login.svg'
import appLogo from 'assets/img/brand/app-logo.svg'
import companyLogo from 'assets/img/brand/company-logo-dark.svg'

const Landing = () => {
const Login = () => {
const authContext = useContext(AuthContext)

if (authContext.isAuthenticated) {
Expand All @@ -20,6 +20,7 @@ const Landing = () => {

return (
<>
<InfoBanner>{INFO_BANNER}</InfoBanner>
<div className={styles.topContainer}>
<div className={styles.innerContainer}>
<div className={styles.textContainer}>
Expand Down Expand Up @@ -66,4 +67,4 @@ const Landing = () => {
)
}

export default Landing
export default Login
1 change: 1 addition & 0 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ export const PRIVACY_URL = process.env.REACT_APP_PRIVACY_URL as string
export const TC_URL = process.env.REACT_APP_TC_URL as string
export const REPORT_BUG_URL = process.env.REACT_APP_REPORT_BUG_URL as string
export const GA_TRACKING_ID = process.env.REACT_APP_GA_TRACKING_ID as string
export const INFO_BANNER = process.env.REACT_APP_INFO_BANNER as string
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
publish = "build"

# Default build command.
command = "npm run build && echo '/* /index.html 200' | cat >build/_redirects"
command = "CI=false npm run build && echo '/* /index.html 200' | cat > build/_redirects"

0 comments on commit 2af8ddb

Please sign in to comment.