Skip to content

Commit 24fa844

Browse files
committed
Merge branch 'advanced-contentful-integration' into develop
2 parents a12f7f0 + 9a8b7bb commit 24fa844

File tree

22 files changed

+281
-276
lines changed

22 files changed

+281
-276
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1526050800,"base":"USD","rates":{"AED":3.673281,"AFN":70.710962,"ALL":106.38,"AMD":485.695,"ANG":1.795715,"AOA":231.4755,"ARS":23.1748,"AUD":1.325261,"AWG":1.791244,"AZN":1.7025,"BAM":1.638591,"BBD":2,"BDT":84.75795,"BGN":1.637434,"BHD":0.376964,"BIF":1781,"BMD":1,"BND":1.3209,"BOB":6.912769,"BRL":3.58416,"BSD":1,"BTC":0.000115593037,"BTN":67.304626,"BWP":9.895515,"BYN":2.007408,"BZD":2.010791,"CAD":1.278478,"CDF":1615,"CHF":0.999819,"CLF":0.02261,"CLP":618.14,"CNH":6.328126,"CNY":6.33218,"COP":2801.425,"CRC":566.695059,"CUC":1,"CUP":25.5,"CVE":92.3795,"CZK":21.342439,"DJF":177.75,"DKK":6.237574,"DOP":49.455,"DZD":115.516125,"EGP":17.7,"ERN":14.998767,"ETB":27.5,"EUR":0.837252,"FJD":2.091148,"FKP":0.737843,"GBP":0.737843,"GEL":2.443508,"GGP":0.737843,"GHS":4.53,"GIP":0.737843,"GMD":47.18,"GNF":9030,"GTQ":7.43045,"GYD":209.314534,"HKD":7.849701,"HNL":23.660322,"HRK":6.1871,"HTG":65.244838,"HUF":263.737692,"IDR":13971.725015,"ILS":3.566515,"IMP":0.737843,"INR":67.345,"IQD":1187.5,"IRR":37453.047379,"ISK":102.495,"JEP":0.737843,"JMD":125.24995,"JOD":0.709506,"JPY":109.37981667,"KES":100.395,"KGS":68.700944,"KHR":4061,"KMF":414.725,"KPW":900,"KRW":1068.315,"KWD":0.3015,"KYD":0.833677,"KZT":327.47765,"LAK":8340,"LBP":1513.65,"LKR":157.905232,"LRD":132.18915,"LSL":12.595,"LYD":1.355,"MAD":9.361773,"MDL":16.539963,"MGA":3240,"MKD":51.56,"MMK":1346.55,"MNT":2397.6995,"MOP":8.088592,"MRO":355.5,"MRU":35.7,"MUR":34.446516,"MVR":15.509851,"MWK":721.045,"MXN":19.312336,"MYR":3.99805,"MZN":60.189545,"NAD":12.585,"NGN":360.5,"NIO":31.285,"NOK":7.993116,"NPR":107.702558,"NZD":1.436022,"OMR":0.384975,"PAB":1,"PEN":3.266209,"PGK":3.28825,"PHP":52.45,"PKR":115.568,"PLN":3.568029,"PYG":5606.1,"QAR":3.640999,"RON":3.879955,"RSD":99,"RUB":61.701,"RWF":865,"SAR":3.75035,"SBD":7.80896,"SCR":13.45505,"SDG":18,"SEK":8.590022,"SGD":1.335489,"SHP":0.737843,"SLL":7786.788251,"SOS":575,"SRD":7.468,"SSP":130.2634,"STD":20574.369681,"STN":20.7,"SVC":8.75317,"SYP":514.92499,"SZL":12.401761,"THB":31.90625,"TJS":8.976386,"TMT":3.50998,"TND":2.490696,"TOP":2.218713,"TRY":4.304889,"TTD":6.74255,"TWD":29.7585,"TZS":2283.15,"UAH":26.2125,"UGX":3716.5,"USD":1,"UYU":28.99,"UZS":8055,"VEF":69900,"VND":22771.156217,"VUV":107.747276,"WST":2.544003,"XAF":549.200993,"XAG":0.05965172,"XAU":0.00075625,"XCD":2.70255,"XDR":0.698904,"XOF":549.200993,"XPD":0.00100104,"XPF":99.910682,"XPT":0.00108109,"YER":250.306642,"ZAR":12.25322,"ZMW":9.899,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1526288400,"base":"USD","rates":{"AED":3.673097,"AFN":70.6555,"ALL":106.155845,"AMD":485.278394,"ANG":1.793103,"AOA":230.9215,"ARS":23.01,"AUD":1.32506,"AWG":1.792496,"AZN":1.7025,"BAM":1.636346,"BBD":2,"BDT":84.636041,"BGN":1.6362,"BHD":0.377163,"BIF":1757.538054,"BMD":1,"BND":1.3317,"BOB":6.903239,"BRL":3.59915,"BSD":1,"BTC":0.000118447452,"BTN":67.192106,"BWP":9.793725,"BYN":1.999105,"BZD":2.008054,"CAD":1.277461,"CDF":1613.322925,"CHF":0.999014,"CLF":0.02263,"CLP":622.4,"CNH":6.330216,"CNY":6.3335,"COP":2823.35,"CRC":566.285059,"CUC":1,"CUP":25.5,"CVE":92.65,"CZK":21.2624,"DJF":177.875,"DKK":6.215882,"DOP":49.537915,"DZD":115.371545,"EGP":17.8213,"ERN":15.0003,"ETB":27.489379,"EUR":0.834407,"FJD":2.092548,"FKP":0.735958,"GBP":0.735958,"GEL":2.442467,"GGP":0.735958,"GHS":4.541563,"GIP":0.735958,"GMD":47.17,"GNF":9017.8,"GTQ":7.420059,"GYD":209.056129,"HKD":7.849881,"HNL":23.718815,"HRK":6.157399,"HTG":65.158071,"HUF":262.989333,"IDR":13971.903325,"ILS":3.57397,"IMP":0.735958,"INR":67.455,"IQD":1191.625723,"IRR":42022.25451,"ISK":101.97,"JEP":0.735958,"JMD":125.080418,"JOD":0.709302,"JPY":109.54628125,"KES":100.3505,"KGS":68.657499,"KHR":4067.716667,"KMF":413.340098,"KPW":900,"KRW":1068.03,"KWD":0.301561,"KYD":0.832538,"KZT":327.437082,"LAK":8320.45,"LBP":1508.062443,"LKR":157.767616,"LRD":132.194575,"LSL":12.262429,"LYD":1.353613,"MAD":9.343639,"MDL":16.519464,"MGA":3258.234946,"MKD":51.325,"MMK":1348.149087,"MNT":2398.25,"MOP":8.077536,"MRO":355.5,"MRU":35.7,"MUR":34.4025,"MVR":15.509851,"MWK":724.975367,"MXN":19.33384,"MYR":3.94353,"MZN":60.190699,"NAD":12.262429,"NGN":359.703899,"NIO":31.304787,"NOK":7.987363,"NPR":107.537394,"NZD":1.438528,"OMR":0.38501,"PAB":1,"PEN":3.264445,"PGK":3.28381,"PHP":52.39,"PKR":115.646195,"PLN":3.556005,"PYG":5598.45,"QAR":3.6376,"RON":3.863314,"RSD":98.607808,"RUB":61.804,"RWF":867.028459,"SAR":3.750245,"SBD":7.83904,"SCR":13.4555,"SDG":18.047192,"SEK":8.582513,"SGD":1.332148,"SHP":0.735958,"SLL":7702.650584,"SOS":577.046453,"SRD":7.468,"SSP":130.2634,"STD":20487.974004,"STN":20.55,"SVC":8.741296,"SYP":515.00499,"SZL":12.264844,"THB":31.803,"TJS":8.96425,"TMT":3.50998,"TND":2.485597,"TOP":2.268754,"TRY":4.323958,"TTD":6.733564,"TWD":29.758,"TZS":2276.750904,"UAH":26.175987,"UGX":3711.35,"USD":1,"UYU":30.033862,"UZS":8051.45,"VEF":69915,"VND":22767.59281,"VUV":107.760201,"WST":2.557217,"XAF":547.334811,"XAG":0.05987853,"XAU":0.000757,"XCD":2.70255,"XDR":0.698904,"XOF":547.334811,"XPD":0.00100506,"XPF":99.571186,"XPT":0.00107936,"YER":250.281642,"ZAR":12.258449,"ZMW":9.885504,"ZWL":322.355011}}

__tests__/shared/components/__snapshots__/Content.jsx.snap

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,21 @@ exports[`Matches shallow shapshot 1`] = `
403403
</Link>
404404
</li>
405405
</ul>
406+
<h3>
407+
Previews of Contentful Components
408+
</h3>
409+
<ul>
410+
<li>
411+
<Link
412+
replace={false}
413+
to="/examples/contentful/banner/5il6oFtWp2Ua6WGs60M2mK"
414+
>
415+
<code>
416+
Banner
417+
</code>
418+
</Link>
419+
</li>
420+
</ul>
406421
<h3>
407422
Sandbox
408423
</h3>
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/shared/components/Content/index.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ export default function Content() {
159159
</li>
160160
</ul>
161161

162+
<h3>Previews of Contentful Components</h3>
163+
<ul>
164+
<li>
165+
<Link to="/examples/contentful/banner/5il6oFtWp2Ua6WGs60M2mK">
166+
<code>Banner</code>
167+
</Link>
168+
</li>
169+
</ul>
170+
162171
<h3>Sandbox</h3>
163172
<p>
164173
The right place to put any experimental and proof-of-concept
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* The core banner rendering.
3+
*/
4+
5+
import _ from 'lodash';
6+
import md from 'utils/markdown';
7+
import PT from 'prop-types';
8+
import React from 'react';
9+
10+
import { themr } from 'react-css-super-themr';
11+
12+
import defaultTheme from './themes/default.scss';
13+
14+
function Banner({
15+
background,
16+
banner,
17+
theme,
18+
}) {
19+
return (
20+
<div
21+
className={theme.container}
22+
style={_.merge({
23+
backgroundImage: `url(${background.file.url})`,
24+
}, banner.containerStyles)}
25+
>
26+
<div className={theme.contentWrapper} style={banner.contentWrapperStyles}>
27+
<div
28+
className={theme.content}
29+
/* eslint-disable react/no-danger */
30+
dangerouslySetInnerHTML={{ __html: md(banner.text) }}
31+
/* eslint-enable react/no-danger */
32+
style={banner.contentStyles}
33+
/>
34+
</div>
35+
</div>
36+
);
37+
}
38+
39+
Banner.propTypes = {
40+
background: PT.shape().isRequired,
41+
banner: PT.shape().isRequired,
42+
theme: PT.shape({
43+
container: PT.string.isRequired,
44+
content: PT.string.isRequired,
45+
contentWrapper: PT.string.isRequired,
46+
}).isRequired,
47+
};
48+
49+
export default themr('Banner', defaultTheme)(Banner);
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* New Banner component.
3+
*/
4+
5+
import ContentfulLoader from 'containers/ContentfulLoader';
6+
import LoadingIndicator from 'components/LoadingIndicator';
7+
import PT from 'prop-types';
8+
import React from 'react';
9+
10+
import Banner from './Banner';
11+
12+
/* eslint-disable global-require */
13+
const THEMES = {
14+
TopGear: require('./themes/top_gear.scss'),
15+
};
16+
/* eslint-enable global-require */
17+
18+
/* Loads banner background asset. */
19+
function BackgroundLoader(props) {
20+
const { banner, preview } = props;
21+
const assetId = banner.backgroundImage.sys.id;
22+
return (
23+
<ContentfulLoader
24+
assetIds={assetId}
25+
preview={preview}
26+
render={data => (
27+
<Banner
28+
{...props}
29+
background={data.assets.items[assetId].fields}
30+
theme={THEMES[banner.baseTheme]}
31+
/>
32+
)}
33+
renderPlaceholder={LoadingIndicator}
34+
/>
35+
);
36+
}
37+
38+
BackgroundLoader.propTypes = {
39+
banner: PT.shape().isRequired,
40+
id: PT.string.isRequired,
41+
preview: PT.bool.isRequired,
42+
};
43+
44+
/* Loads the main banner entry. */
45+
export default function BannerLoader(props) {
46+
const { id, preview } = props;
47+
return (
48+
<ContentfulLoader
49+
entryIds={id}
50+
preview={preview}
51+
render={data => (
52+
<BackgroundLoader
53+
{...props}
54+
banner={data.entries.items[id].fields}
55+
/>
56+
)}
57+
renderPlaceholder={LoadingIndicator}
58+
/>
59+
);
60+
}
61+
62+
BannerLoader.defaultProps = {
63+
preview: false,
64+
};
65+
66+
BannerLoader.propTypes = {
67+
id: PT.string.isRequired,
68+
preview: PT.bool,
69+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Default banner styling. */
2+
3+
@import "~styles/mixins";
4+
5+
.container {
6+
background-position: 50% 50%;
7+
background-size: cover;
8+
height: 480px;
9+
overflow: hidden;
10+
position: relative;
11+
}
12+
13+
.content {
14+
@include roboto-regular;
15+
16+
color: white;
17+
18+
h1 { margin-bottom: 10px; }
19+
p { margin: 5px 0; }
20+
}
21+
22+
.contentWrapper {
23+
background: black;
24+
opacity: 0.6;
25+
padding: 30px;
26+
position: absolute;
27+
left: 50%;
28+
top: 50%;
29+
transform: translate(-50%, -50%);
30+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.content {
2+
font-family: "Akkurat mono", monospace;
3+
line-height: 150%;
4+
5+
h1 {
6+
font: bold 20px/150% "Akkurat mono", monospace;
7+
text-decoration: underline;
8+
}
9+
10+
p { margin: 10px 0; }
11+
}
12+
13+
.contentWrapper {
14+
background: #eb3747;
15+
border-radius: 50%;
16+
height: 360px;
17+
opacity: 1;
18+
padding: 60px;
19+
width: 360px;
20+
top: 480px;
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Banner from 'components/Contentful/Banner';
2+
import ContentfulLoader from 'containers/ContentfulLoader';
3+
import LoadingIndicator from 'components/LoadingIndicator';
4+
import React from 'react';
5+
6+
export default function ChallengeListingBanner() {
7+
return (
8+
<ContentfulLoader
9+
entryQueries={{
10+
content_type: 'banner',
11+
'fields.name': 'TopGear - Challenge Listing - Banner',
12+
}}
13+
render={d => d.entries.matches[0].items.map(id => <Banner id={id} />)}
14+
renderPlaceholder={LoadingIndicator}
15+
/>
16+
);
17+
}

src/shared/components/tc-communities/communities/wipro/ChallengeListingBanner/index.jsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/shared/components/tc-communities/communities/wipro/ChallengeListingBanner/style.scss

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/shared/components/tc-communities/communities/wipro/Home/index.jsx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
* thus we disable max-len eslint rule for this file
66
*/
77

8+
import Banner from 'components/Contentful/Banner';
9+
import ContentfulLoader from 'containers/ContentfulLoader';
810
import React from 'react';
911
import Section from 'components/tc-communities/Section';
10-
import Banner from 'components/tc-communities/Banner';
1112
import ImageText from 'components/tc-communities/ImageText';
13+
import LoadingIndicator from 'components/LoadingIndicator';
1214
/*
1315
import ResourceCard from 'components/tc-communities/ResourceCard';
1416
import NewsletterSignup from 'components/tc-communities/NewsletterSignup';
@@ -25,16 +27,13 @@ import PT from 'prop-types';
2527
import JoinCommunity from 'containers/tc-communities/JoinCommunity';
2628
import CommunityStats from 'containers/tc-communities/CommunityStats';
2729

28-
import bannerImage from 'assets/images/communities/wipro/home/banner.jpg';
29-
3030
/*
3131
import IconRocket from '../../../../../../assets/images/tc-communities/rocket.svg';
3232
import IconNetwork from '../../../../../../assets/images/tc-communities/network.svg';
3333
import IconMedal from '../../../../../../assets/images/tc-communities/medal.svg';
3434
*/
3535

3636
import style from './style.scss';
37-
import bannerStyle from './themes/banner.scss';
3837
import IconStatStyles from './themes/IconStatStyles.scss';
3938
// import NewsletterSignupStyle from './themes/newsletter_signup.scss';
4039
import ImageTextStyles from './themes/imageTextStyle.scss';
@@ -118,20 +117,14 @@ export default function Home(props) {
118117

119118
return (
120119
<main>
121-
<Banner
122-
title="Deliver your project&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;requirements faster&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;through crowdsourcing&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;"
123-
imageSrc={bannerImage}
124-
theme={bannerStyle}
125-
>
126-
<p>
127-
Tap into the Wipro global/account expert pool for your project
128-
requirements.
129-
</p>
130-
<p>
131-
Engage TopGear for bringing in velocity, additional bandwidth and
132-
capability to meet your project requirements.
133-
</p>
134-
</Banner>
120+
<ContentfulLoader
121+
entryQueries={{
122+
content_type: 'banner',
123+
'fields.name': 'TopGear - Home - Banner',
124+
}}
125+
render={d => d.entries.matches[0].items.map(id => <Banner id={id} />)}
126+
renderPlaceholder={LoadingIndicator}
127+
/>
135128

136129
<CommunityStats theme={IconStatStyles} icons={COMMUNITY_STATS_ICONS} />
137130

0 commit comments

Comments
 (0)