-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract social buttons into component SocialAuthButtonList
- Loading branch information
1 parent
43a5267
commit 47de115
Showing
3 changed files
with
69 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<PageLayout hasGrid={false}> | ||
<Head | ||
links={[ | ||
'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/5.0.0/bootstrap-social.min.css', | ||
]} | ||
/> | ||
<Grid> | ||
<PageHeader>Login</PageHeader> | ||
<Row> | ||
<Col md={12}> | ||
{next && ( | ||
<Alert bsStyle="warning"> | ||
<strong>Authentication Required</strong> | ||
{' '}Please login first. | ||
</Alert> | ||
)} | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col md={9}> | ||
<LoginForm /> | ||
</Col> | ||
<Col md={3}> | ||
<a | ||
href={`/auth/facebook${search}`} | ||
className="btn btn-block btn-social btn-facebook" | ||
> | ||
<span className="fa fa-facebook"></span>Login with Facebook | ||
</a> | ||
<a | ||
href={`/auth/linkedin${search}`} | ||
className="btn btn-block btn-social btn-linkedin" | ||
> | ||
<span className="fa fa-linkedin"></span>Login with LinkedIn | ||
</a> | ||
</Col> | ||
</Row> | ||
</Grid> | ||
</PageLayout> | ||
); | ||
}; | ||
let LoginPage = ({ location }) => ( | ||
<PageLayout> | ||
<PageHeader>Login</PageHeader> | ||
<Row> | ||
<Col md={12}> | ||
{location.query.next && ( | ||
<Alert bsStyle="warning"> | ||
<strong>Authentication Required</strong> | ||
{' '}Please login first. | ||
</Alert> | ||
)} | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col md={9}> | ||
<LoginForm /> | ||
</Col> | ||
<Col md={3}> | ||
<SocialAuthButtonList /> | ||
</Col> | ||
</Row> | ||
</PageLayout> | ||
); | ||
|
||
export default LoginPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div> | ||
<Head | ||
links={[ | ||
'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/5.0.0/bootstrap-social.min.css', | ||
]} | ||
/> | ||
<a | ||
href={`/auth/facebook${search}`} | ||
className="btn btn-block btn-social btn-facebook" | ||
> | ||
<span className="fa fa-facebook"></span>Login with Facebook | ||
</a> | ||
<a | ||
href={`/auth/linkedin${search}`} | ||
className="btn btn-block btn-social btn-linkedin" | ||
> | ||
<span className="fa fa-linkedin"></span>Login with LinkedIn | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default connect(state => ({ | ||
routing: state.routing, | ||
}))(SocialAuthButtonList); |