Skip to content

Commit 403d9d7

Browse files
committed
modal tweks
1 parent d17b4ea commit 403d9d7

File tree

3 files changed

+172
-3
lines changed

3 files changed

+172
-3
lines changed

src/shared/components/Contentful/Article/Article.jsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import {
2323
config, Link, isomorphy,
2424
} from 'topcoder-react-utils';
2525
import qs from 'qs';
26-
import LoginModal from 'components/Gigs/LoginModal';
26+
import LoginModal from 'components/LoginModal';
27+
import modalStyle from 'components/LoginModal/modal.scss';
2728
// SVGs and assets
2829
import GestureIcon from 'assets/images/icon-gesture.svg';
2930
import ReadMoreArrow from 'assets/images/read-more-arrow.svg';
@@ -398,8 +399,17 @@ class Article extends React.Component {
398399
}
399400
</div>
400401
{
401-
// eslint-disable-next-line no-restricted-globals
402-
showLogin && <LoginModal retUrl={isomorphy.isClientSide() ? location.href : null} onCancel={() => this.setState({ showLogin: false })} utmSource="thrive_article" />
402+
showLogin && (
403+
<LoginModal
404+
// eslint-disable-next-line no-restricted-globals
405+
retUrl={isomorphy.isClientSide() ? location.href : null}
406+
onCancel={() => this.setState({ showLogin: false })}
407+
modalTitle="Want to vote?"
408+
modalText="You must be a Topcoder member to do that."
409+
utmSource="thrive_article"
410+
infoNode={<p className={modalStyle.regTxt}>Discover <a href="/community/learn" target="_blank" rel="noreferrer">other features</a> you can access by becoming a member.</p>}
411+
/>
412+
)
403413
}
404414
</React.Fragment>
405415
);
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Generic Login Modal Dialog
3+
*/
4+
/* global window */
5+
6+
import PT from 'prop-types';
7+
import React from 'react';
8+
import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
9+
import { config, Link } from 'topcoder-react-utils';
10+
import tc from 'components/buttons/themed/tc.scss';
11+
import modalStyle from './modal.scss';
12+
13+
/** Themes for buttons
14+
* those overwrite PrimaryButton style to match achieve various styles.
15+
* Should implement pattern of classes.
16+
*/
17+
const buttonThemes = {
18+
tc,
19+
};
20+
21+
function LoginModal({
22+
onCancel,
23+
retUrl,
24+
utmSource,
25+
modalTitle,
26+
modalText,
27+
infoNode,
28+
}) {
29+
return (
30+
<Modal
31+
onCancel={onCancel}
32+
theme={modalStyle}
33+
>
34+
<div className={modalStyle.loginRequired}>
35+
<h3 className={modalStyle.title}>{modalTitle}</h3>
36+
<p className={modalStyle.loginMsg}>{modalText}</p>
37+
<div className={modalStyle.ctaButtons}>
38+
<PrimaryButton
39+
onClick={() => {
40+
window.location = `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(retUrl)}`;
41+
}}
42+
theme={{
43+
button: buttonThemes.tc['primary-green-md'],
44+
}}
45+
>
46+
LOGIN
47+
</PrimaryButton>
48+
<Link to={`${config.URL.AUTH}/member/registration?retUrl=${encodeURIComponent(retUrl)}&mode=signUp${utmSource ? `&utm_source=${utmSource}` : ''}`} className={buttonThemes.tc['primary-white-md']}>REGISTER</Link>
49+
</div>
50+
{infoNode}
51+
</div>
52+
</Modal>
53+
);
54+
}
55+
56+
LoginModal.defaultProps = {
57+
utmSource: null,
58+
infoNode: null,
59+
};
60+
61+
LoginModal.propTypes = {
62+
onCancel: PT.func.isRequired,
63+
retUrl: PT.string.isRequired,
64+
utmSource: PT.string,
65+
modalTitle: PT.string.isRequired,
66+
modalText: PT.string.isRequired,
67+
infoNode: PT.node,
68+
};
69+
70+
export default LoginModal;
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* stylelint-disable no-descending-specificity */
2+
@import "~styles/mixins";
3+
@import "~components/Contentful/default";
4+
5+
.container {
6+
padding: 0;
7+
width: auto;
8+
max-width: 95vw;
9+
height: auto;
10+
max-height: 95vh;
11+
border-radius: 10px;
12+
display: flex;
13+
flex-direction: column;
14+
justify-content: center;
15+
16+
@include gui-kit-headers;
17+
@include gui-kit-content;
18+
19+
@include xs-to-sm {
20+
width: 90vw;
21+
max-width: 90vw;
22+
}
23+
24+
.title {
25+
color: #1e94a3;
26+
font-family: BarlowCondensed, sans-serif;
27+
font-size: 34px;
28+
line-height: 38px;
29+
font-weight: 500;
30+
margin: 0;
31+
margin-bottom: 20px;
32+
}
33+
34+
.loginMsg {
35+
color: #2a2a2a;
36+
font-size: 24px;
37+
line-height: 36px;
38+
margin-bottom: 40px;
39+
}
40+
41+
.ctaButtons {
42+
display: flex;
43+
align-content: center;
44+
justify-content: center;
45+
46+
& > button:first-child {
47+
margin-right: 10px !important;
48+
}
49+
50+
& > a:first-child {
51+
margin-right: 10px !important;
52+
}
53+
}
54+
55+
.loginRequired {
56+
display: flex;
57+
flex-direction: column;
58+
padding: 100px 80px;
59+
text-align: center;
60+
61+
@include xs-to-sm {
62+
padding: 20px 15px;
63+
}
64+
65+
.loginMsg {
66+
font-size: 20px;
67+
}
68+
69+
.regTxt {
70+
font-size: 14px;
71+
margin: 10px 0 0;
72+
}
73+
74+
.ctaButtons {
75+
@include xs-to-sm {
76+
flex-direction: column;
77+
78+
> button {
79+
margin: 0 0 20px !important;
80+
}
81+
}
82+
}
83+
}
84+
}
85+
86+
.overlay {
87+
background-color: #2a2a2a;
88+
opacity: 0.95;
89+
}

0 commit comments

Comments
 (0)