-
Notifications
You must be signed in to change notification settings - Fork 585
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
10 changed files
with
211 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// Imports | ||
import React, { Component } from 'react' | ||
|
||
// UI Imports | ||
import { Grid, GridCell } from '../ui/grid' | ||
import { H1, H6 } from '../ui/typography' | ||
import Modal from '../ui/modal/Modal' | ||
import Button from '../ui/button' | ||
import { white } from '../ui/common/colors' | ||
import { textLevel1 } from '../ui/common/shadows' | ||
|
||
// App Imports | ||
|
||
// Component | ||
class Onboarding extends Component { | ||
|
||
constructor(props) { | ||
super(props) | ||
|
||
this.state = { | ||
visible: false, | ||
currentStep: 0 | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
const onboarding = window.localStorage.getItem('onboarding') | ||
if(!onboarding) { | ||
this.toggleVisible(true) | ||
|
||
window.localStorage.setItem('onboarding', 1) | ||
} | ||
} | ||
|
||
toggleVisible = (visible) => { | ||
this.setState({ | ||
visible | ||
}) | ||
} | ||
|
||
nextStep = () => { | ||
this.setState(state => ({ | ||
currentStep: state.currentStep + 1 | ||
})) | ||
} | ||
|
||
close = () => { | ||
this.toggleVisible(false) | ||
} | ||
|
||
render() { | ||
const steps = [ | ||
<Grid gutter={ false } alignCenter={ true } style={ { height: '100%', textAlign: 'center', color: white } }> | ||
{/* 1. Welcome to Crate */} | ||
|
||
{/* Left - Headline and info */} | ||
<GridCell> | ||
<H1 font="secondary" style={ { textShadow: textLevel1 } }>Welcome to Crate</H1> | ||
|
||
<H6 style={ { marginTop: '0.5em' } }>Your monthly subscription of trendy <br/> clothes and accessories</H6> | ||
|
||
<Button theme="primary" style={ { marginTop: '1.5em' } } onClick={ this.nextStep }>Next</Button> | ||
</GridCell> | ||
|
||
{/* Right - Image */} | ||
<GridCell> | ||
<img src={ '/images/collage.png' } alt="collage" title="products collage" style={ { width: 400 } } /> | ||
</GridCell> | ||
</Grid>, | ||
|
||
<Grid gutter={ false } alignCenter={ true } style={ { height: '100%', textAlign: 'center', color: white } }> | ||
{/* 2. For Men */} | ||
|
||
{/* Left - Image */} | ||
<GridCell> | ||
<img src={ '/images/collage.png' } alt="collage" title="products collage" style={ { width: 400 } } /> | ||
</GridCell> | ||
|
||
{/* Right - Headline and info */} | ||
<GridCell> | ||
<H1 font="secondary" style={ { textShadow: textLevel1 } }>For Men</H1> | ||
|
||
<H6 style={ { marginTop: '0.5em' } }>Your monthly subscription of trendy <br/> clothes and accessories</H6> | ||
|
||
<Button theme="primary" style={ { marginTop: '1.5em' } } onClick={ this.nextStep }>Next</Button> | ||
</GridCell> | ||
</Grid>, | ||
|
||
<Grid gutter={ false } alignCenter={ true } style={ { height: '100%', textAlign: 'center', color: white } }> | ||
{/* 3. For Women */} | ||
|
||
{/* Left - Headline and info */} | ||
<GridCell> | ||
<H1 font="secondary" style={ { textShadow: textLevel1 } }>For Women</H1> | ||
|
||
<H6 style={ { marginTop: '0.5em' } }>Your monthly subscription of trendy <br/> clothes and accessories</H6> | ||
|
||
<Button theme="primary" style={ { marginTop: '1.5em' } } onClick={ this.nextStep }>Next</Button> | ||
</GridCell> | ||
|
||
{/* Right - Image */} | ||
<GridCell> | ||
<img src={ '/images/collage.png' } alt="collage" title="products collage" style={ { width: 400 } } /> | ||
</GridCell> | ||
</Grid>, | ||
|
||
<Grid gutter={ false } alignCenter={ true } style={ { height: '100%', textAlign: 'center', color: white } }> | ||
{/* 4. Fix me up */} | ||
|
||
{/* Center - Headline and info */} | ||
<GridCell> | ||
<H1 font="secondary" style={ { textShadow: textLevel1 } }>Fix me up</H1> | ||
|
||
<H6 style={ { marginTop: '0.5em' } }>Subscribe to your crate!</H6> | ||
|
||
<Button theme="primary" style={ { marginTop: '1.5em' } } onClick={ this.close }>Start</Button> | ||
</GridCell> | ||
</Grid> | ||
] | ||
|
||
return( | ||
<div> | ||
{/* Modal */} | ||
<Modal visible={ this.state.visible }> | ||
{ steps[this.state.currentStep] } | ||
</Modal> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Onboarding |
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,26 @@ | ||
// Imports | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
// Component | ||
const Modal = (props) => { | ||
const { children, visible, ...other } = props | ||
|
||
return( | ||
<div { ...other } style={ { position: 'fixed', top: 0, right: 0, bottom: 0, left: 0, zIndex: 9, visibility: (visible ? 'visible' : 'hidden'), opacity: (visible ? 1 : 0), transition: 'opacity 0.25s ease-in-out' } }> | ||
<div style={ { background: `url('/images/cover.jpg') top center`, backgroundSize: 'cover', position: 'fixed', top: '-40px', right: '-40px', bottom: '-40px', left: '-40px', zIndex: -1, filter: 'blur(25px)' } } /> | ||
|
||
{ children } | ||
</div> | ||
) | ||
} | ||
|
||
// Component Properties | ||
Modal.propTypes = { | ||
visible: PropTypes.bool.isRequired | ||
} | ||
Modal.defaultProps = { | ||
visible: false | ||
} | ||
|
||
export default Modal |
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,4 @@ | ||
// UI Imports | ||
import Modal from './Modal' | ||
|
||
export { Modal } |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
// Imports | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
|
||
// UI Imports | ||
import { Modal } from '../../src/client/components/ui/modal' | ||
|
||
// Buttons | ||
storiesOf('Modal', module) | ||
.add('simple', () => ( | ||
<Modal> | ||
<p>Hello world</p> | ||
</Modal> | ||
)) |
Binary file not shown.