Skip to content

Commit edc7cc6

Browse files
authored
Merge pull request #500 from devinit/development
release/v3.5.2
2 parents e32dae0 + 3a84550 commit edc7cc6

File tree

7 files changed

+88
-13
lines changed

7 files changed

+88
-13
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devinit/dh-app",
3-
"version": "3.5.1",
3+
"version": "3.5.2",
44
"config": {
55
"API": "http://212.111.41.68:3000/graphql",
66
"API_DEV": "http://212.111.41.68:9090/graphql",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import * as React from 'react';
2+
import { css } from 'glamor';
3+
import { Container, Grid, Message } from 'semantic-ui-react';
4+
import * as localforage from 'localforage';
5+
6+
const messageStyles = css({
7+
textAlign: 'center',
8+
marginBottom: '0 !important',
9+
backgroundColor: '#fee7c1 !important',
10+
color: '#794b02 !important'
11+
});
12+
const textStyle = css({
13+
fontWeight: 'bold',
14+
paddingRight: '3rem !important'
15+
});
16+
const closeButtonStyles = css({
17+
position: 'absolute',
18+
top: '38px',
19+
right: '16px',
20+
cursor: 'pointer'
21+
});
22+
23+
class Banner extends React.Component {
24+
state = { showBanner: false };
25+
26+
render() {
27+
if (this.state.showBanner) {
28+
return (
29+
<Container style={ { padding: '1rem' } }>
30+
<Message warning { ...messageStyles } floating size="large">
31+
<Grid columns={ 2 } container stackable>
32+
<Grid.Row>
33+
<Grid.Column width={ 1 }>
34+
<i aria-hidden="true" className="icon warning sign big"/>
35+
</Grid.Column>
36+
<Grid.Column width={ 15 } { ...textStyle }>
37+
The Development Data Hub is not currently displaying the most up-to-date data,
38+
as it is soon to undergo redevelopment.
39+
If you have any data-related questions please email info@devinit.org
40+
</Grid.Column>
41+
</Grid.Row>
42+
<i aria-hidden="true" className="icon close" { ...closeButtonStyles } onClick={ this.onClose }/>
43+
</Grid>
44+
</Message>
45+
</Container>
46+
);
47+
}
48+
49+
return null;
50+
}
51+
52+
componentDidMount() {
53+
localforage.getItem('showBanner').then(showBanner => {
54+
if (showBanner === null) {
55+
this.setState({ showBanner: true });
56+
localforage.setItem('showBanner', true);
57+
} else {
58+
this.setState({ showBanner });
59+
}
60+
});
61+
}
62+
63+
private onClose = () => {
64+
this.setState({ showBanner: false });
65+
localforage.setItem('showBanner', false);
66+
}
67+
}
68+
69+
export default Banner;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Banner';

src/components/molecules/Menu/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { css } from 'glamor';
12
import glamorous from 'glamorous';
23
import { red, white } from '../../theme/semantic';
34
import { Container } from 'semantic-ui-react';
@@ -22,13 +23,15 @@ const MenuContainer = glamorous.div({
2223
height: '57px'
2324
});
2425

26+
const containerStyles = css({ overflow: 'hidden !important' });
27+
2528
export type Props = Menu & {
2629
nextLink?: React.ComponentClass<LinkState>;
2730
};
2831

2932
const menu = (props: Props) =>
3033
<MenuContainer>
31-
<Container>
34+
<Container { ...containerStyles }>
3235
<Logo />
3336
<DesktopMenu { ...props } />
3437
<MobileMenu { ...props } />
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import Link from 'next/link';
12
import * as React from 'react';
23
import { Container } from 'semantic-ui-react';
4+
import Banner from '../../molecules/Banner/Banner';
35
import Footer from '../../molecules/Footer';
46
import Menu from '../../molecules/Menu';
5-
import Link from 'next/link';
67
import { menuData } from './data';
78

89
interface Props {
@@ -11,11 +12,12 @@ interface Props {
1112

1213
const Generic: React.SFC<Props> = ({ children }) =>
1314
<Container fluid>
14-
<Menu menu={ menuData.menu } nextLink={ Link } />
15-
<div style={ { marginTop: '4em' } }>
16-
{ children }
17-
</div>
18-
<Footer />
15+
<Menu menu={ menuData.menu } nextLink={ Link } />
16+
<div style={ { marginTop: '4em' } }>
17+
<Banner/>
18+
{ children }
19+
</div>
20+
<Footer />
1921
</Container>;
2022

2123
export default Generic;

src/components/templates/Spotlight/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { capitalize } from '@devinit/prelude/lib/strings';
2+
import { css } from 'glamor';
23
import { Div, H4, Img } from 'glamorous';
4+
import Link from 'next/link';
35
import router from 'next/router';
46
import * as React from 'react';
57
import { Container, Grid, Icon } from 'semantic-ui-react';
@@ -10,11 +12,9 @@ import DynamicMap from '../../organisms/Map/DynamicMap';
1012
import SpotLightNavTabsKe, { SpotlightKeProps } from '../../organisms/NavBarTabs/spotlightKe';
1113
import SpotLightNavTabsUg, { SpotlightUgProps } from '../../organisms/NavBarTabs/spotlightUg';
1214
import { getSpotlightPageData } from '../../pageData';
15+
import { mediaQueries } from '../../theme';
1316
import { Country } from '../../types';
1417
import Generic from '../Generic';
15-
import Link from 'next/link';
16-
import { css } from 'glamor';
17-
import { mediaQueries } from '../../theme';
1818

1919
const responsiveCountryProfile = css({
2020
[mediaQueries.phone]: {
@@ -41,7 +41,7 @@ export default class Spotlight extends React.Component<Props> {
4141
const navState = { state: this.props.state } as SpotlightKeProps | SpotlightUgProps;
4242

4343
return (
44-
<Generic >
44+
<Generic>
4545
<Container>
4646
<H4 paddingTop="2em" position="absolute" right="20%" { ...responsiveCountryProfile }>
4747
{ this.renderCountryFlag() }

0 commit comments

Comments
 (0)