-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
195 additions
and
321 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
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
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 |
---|---|---|
@@ -1,58 +1,57 @@ | ||
import styled, {css} from 'styled-components'; | ||
import styled, { css } from 'styled-components'; | ||
|
||
const buttonStyles = css` | ||
background-color: black; | ||
color: white; | ||
border: none; | ||
&:hover { | ||
background-color: white; | ||
color: black; | ||
border: 1px solid black; | ||
} | ||
`; | ||
|
||
const invertedButtonStyles = css` | ||
background-color: black; | ||
color: white; | ||
border: none; | ||
&:hover { | ||
background-color: white; | ||
color: black; | ||
border: 1px solid black; | ||
&:hover { | ||
background-color: black; | ||
color: white; | ||
border: none; | ||
} | ||
} | ||
`; | ||
const googleSignInStyles = css` | ||
background-color: #4285f4; | ||
|
||
const invertedButtonStyles = css` | ||
background-color: white; | ||
color: black; | ||
border: 1px solid black; | ||
&:hover { | ||
background-color: black; | ||
color: white; | ||
border: none; | ||
} | ||
`; | ||
|
||
&:hover { | ||
background-color: #357ae8; | ||
border: none; | ||
} | ||
const googleSignInStyles = css` | ||
background-color: #4285f4; | ||
color: white; | ||
&:hover { | ||
background-color: #357ae8; | ||
border: none; | ||
} | ||
`; | ||
|
||
const getButtonStyles = props =>{ | ||
if(props.isGoogleSignIn){ | ||
return googleSignInStyles | ||
} | ||
return props.inverted ? invertedButtonStyles: buttonStyles; | ||
} | ||
const getButtonStyles = props => { | ||
if (props.isGoogleSignIn) { | ||
return googleSignInStyles; | ||
} | ||
|
||
export const CustomButtonContainer = styled.button` | ||
min-width: 165px; | ||
width: auto; | ||
height: 50px; | ||
letter-spacing: 0.5px; | ||
line-height: 50px; | ||
padding: 0 35px 0 35px; | ||
font-size: 15px; | ||
text-transform: uppercase; | ||
font-family: 'Open Sans Condensed'; | ||
font-weight: bolder; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
return props.inverted ? invertedButtonStyles : buttonStyles; | ||
}; | ||
|
||
${getButtonStyles} | ||
export const CustomButtonContainer = styled.button` | ||
min-width: 165px; | ||
width: auto; | ||
height: 50px; | ||
letter-spacing: 0.5px; | ||
line-height: 50px; | ||
padding: 0 35px 0 35px; | ||
font-size: 15px; | ||
text-transform: uppercase; | ||
font-family: 'Open Sans Condensed'; | ||
font-weight: bolder; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
${getButtonStyles} | ||
`; |
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,17 @@ | ||
import React from 'react'; | ||
|
||
import {SpinnerContainer, SpinnerOverlay} from './with-spinner.styles'; | ||
|
||
const WithSpinner = WrappedDocument => { | ||
const Spinner = ({isLoading, ...otherProps}) => { | ||
return isLoading ? ( | ||
<SpinnerOverlay> | ||
<SpinnerContainer /> | ||
</SpinnerOverlay> | ||
) : ( | ||
<WrappedDocument {...otherProps} /> | ||
) | ||
} | ||
return Spinner; | ||
} | ||
export default WithSpinner; |
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,30 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const SpinnerOverlay = styled.div` | ||
height: 60vh; | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`; | ||
|
||
export const SpinnerContainer = styled.div` | ||
display: inline-block; | ||
width: 50px; | ||
height: 50px; | ||
border: 3px solid rgba(195, 195, 195, 0.6); | ||
border-radius: 50%; | ||
border-top-color: #636767; | ||
animation: spin 1s ease-in-out infinite; | ||
-webkit-animation: spin 1s ease-in-out infinite; | ||
@keyframes spin { | ||
to { | ||
-webkit-transform: rotate(360deg); | ||
} | ||
} | ||
@-webkit-keyframes spin { | ||
to { | ||
-webkit-transform: rotate(360deg); | ||
} | ||
} | ||
`; |
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 |
---|---|---|
@@ -1,16 +1,51 @@ | ||
import React from 'react'; | ||
import { Route } from 'react-router-dom'; | ||
import {connect} from 'react-redux'; | ||
|
||
import CollectionOverview from '../../components/collections-overview/collections-overview.component'; | ||
import CollectionPage from '../collection/collection.component'; | ||
|
||
const ShopPage = ({ match }) => ( | ||
<div className="shopPage"> | ||
<Route exact path={`${match.path}`} component={CollectionOverview} /> | ||
<Route path={`${match.path}/:collectionId`} component={CollectionPage} /> | ||
import {firestore, convertCollectionsSnapshotToMap} from '../../fireabase/firebase.utils'; | ||
import { updateCollections } from '../../redux/shop/shop.actions'; | ||
import WithSpinner from '../../components/with-spinner/with-spinner.component'; | ||
|
||
const CollectionsOverviewWithSpinner = WithSpinner(CollectionOverview); | ||
const CollectionPageWithSpinner = WithSpinner(CollectionPage); | ||
|
||
class ShopPage extends React.Component { | ||
state = { | ||
loading: true | ||
} | ||
unsubscribeFromSnapshot = null; | ||
|
||
componentDidMount() { | ||
const {updateCollections} = this.props; | ||
const collectionRef = firestore.collection('collections'); | ||
|
||
//this.unsubscribeFromSnapshot = | ||
|
||
collectionRef.get().then( snapshot=>{ | ||
const collectionsMap = convertCollectionsSnapshotToMap(snapshot); | ||
updateCollections(collectionsMap); | ||
this.setState({loading:false}); | ||
} | ||
); | ||
} | ||
|
||
render() { | ||
const { match } = this.props; | ||
const { loading } = this.state; | ||
return(<div className='shop-page'> | ||
<Route exact path={`${match.path}`} render={(props) => <CollectionsOverviewWithSpinner isLoading={loading} {...props} />} /> | ||
<Route path={`${match.path}/:collectionId`} render={(props) => <CollectionPageWithSpinner isLoading={loading} {...props} />} /> | ||
|
||
</div> | ||
) | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
updateCollections: collectionsMap => dispatch(updateCollections(collectionsMap)) | ||
}) | ||
|
||
export default ShopPage; | ||
export default connect(null, mapDispatchToProps)(ShopPage); |
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,6 @@ | ||
import ShopActionTypes from './shop.type'; | ||
|
||
export const updateCollections = collectionsMap => ({ | ||
type: ShopActionTypes.UPDATE_COLLECTIONS, | ||
payload: collectionsMap | ||
}); |
Oops, something went wrong.