From 47de1152d717a5472cc8ae8132de4c396b88e7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E6=B2=BB=E5=B9=B3?= Date: Tue, 1 Nov 2016 00:08:36 +0800 Subject: [PATCH] Extract social buttons into component SocialAuthButtonList --- src/common/components/pages/user/LoginPage.js | 72 +++++++------------ .../components/pages/user/RegisterPage.js | 12 +++- .../components/utils/SocialAuthButtonList.js | 34 +++++++++ 3 files changed, 69 insertions(+), 49 deletions(-) create mode 100644 src/common/components/utils/SocialAuthButtonList.js diff --git a/src/common/components/pages/user/LoginPage.js b/src/common/components/pages/user/LoginPage.js index 69c2665..8f91895 100644 --- a/src/common/components/pages/user/LoginPage.js +++ b/src/common/components/pages/user/LoginPage.js @@ -1,58 +1,34 @@ import React from 'react'; import PageHeader from 'react-bootstrap/lib/PageHeader'; import Alert from 'react-bootstrap/lib/Alert'; -import Grid from 'react-bootstrap/lib/Grid'; import Row from 'react-bootstrap/lib/Row'; import Col from 'react-bootstrap/lib/Col'; import PageLayout from '../../layouts/PageLayout'; -import Head from '../../widgets/Head'; import LoginForm from '../../forms/user/LoginForm'; +import SocialAuthButtonList from '../../utils/SocialAuthButtonList'; -let LoginPage = ({ location }) => { - let { next } = location.query; - let search = next ? '?next=' + next : ''; - - return ( - - - - Login - - - {next && ( - - Authentication Required - {' '}Please login first. - - )} - - - - - - - - - Login with Facebook - - - Login with LinkedIn - - - - - - ); -}; +let LoginPage = ({ location }) => ( + + Login + + + {location.query.next && ( + + Authentication Required + {' '}Please login first. + + )} + + + + + + + + + + + +); export default LoginPage; diff --git a/src/common/components/pages/user/RegisterPage.js b/src/common/components/pages/user/RegisterPage.js index 86b73e5..5cceff8 100644 --- a/src/common/components/pages/user/RegisterPage.js +++ b/src/common/components/pages/user/RegisterPage.js @@ -1,12 +1,22 @@ import React from 'react'; import PageHeader from 'react-bootstrap/lib/PageHeader'; +import Row from 'react-bootstrap/lib/Row'; +import Col from 'react-bootstrap/lib/Col'; import PageLayout from '../../layouts/PageLayout'; import RegisterForm from '../../forms/user/RegisterForm'; +import SocialAuthButtonList from '../../utils/SocialAuthButtonList'; const RegisterPage = (props) => ( Register - + + + + + + + + ); diff --git a/src/common/components/utils/SocialAuthButtonList.js b/src/common/components/utils/SocialAuthButtonList.js new file mode 100644 index 0000000..bd8c72c --- /dev/null +++ b/src/common/components/utils/SocialAuthButtonList.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import Head from '../widgets/Head'; + +let SocialAuthButtonList = ({ routing }) => { + let { next } = routing.locationBeforeTransitions.query; + let search = next ? '?next=' + next : ''; + + return ( +
+ + + Login with Facebook + + + Login with LinkedIn + +
+ ); +}; + +export default connect(state => ({ + routing: state.routing, +}))(SocialAuthButtonList);