Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="root"></div>
              
            
!

CSS

              
                @charset "utf-8";
html { box-sizing: border-box; }

*,
*::before,
*::after { box-sizing: inherit; }
*,
*:active,
*:focus {
  outline: 0;
  outline-style: none;
  outline-width: 0;
}

div,
span {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  vertical-align: baseline;
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
  select,
  textarea,
  input,
  select:focus,
  textarea:focus,
  input:focus {
    font-size: 16px;
  }
}
body {
  margin: 0;
  padding: 0;
  background: #fff;
  font-family: 'Roboto','Helvetica Neue','HelveticaNeue',Helvetica,Arial,sans-serif;
  font-weight: 400;
  line-height: 1.4em;
  font-size: 14px;
  font-style: normal;
  color: #444;
  text-align: left;
  direction: ltr;
}
#root {
  padding: 8px 12px;
}
.app_shell {
  position: relative;
}
.header {
  position: fixed;
  width: 100%;
  z-index: 999;
  left: 0;
  top: 0;
  padding: 8px 12px;
}
.header > * {
  display: inline-block;
  font-weight: 300;
  font-size: 16px;
  margin: 0;
  padding: 9px 0;
  line-height: 1;
}
.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-weight: 300;
  /* color: #0277BD; */
  color: #039BE5;
  border-top: 1px solid #d3d6db;
  background: #e9eaed;
  padding: 10px 0;
}
.footer > span {
  cursor: pointer;
  line-height: 1;
}
.welcome_viewport {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding-top: 44px;
  z-index: 1;
}
.welcome_track {
  position: relative;
  padding: 0;
  height: 100%;
}
.welcome_view {
  vertical-align: top;
  display: inline-block;
  height: 100%;
  text-align: center;
  padding: 0 24px;
  position: relative;
}

.btn {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.42857143;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-image: none;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-tap-highlight-color: transparent;
}

.btn-default {
  display: block;
  width: 100%;
  border-radius: 3px;
  border: 1px solid #039BE5;
  background: #039BE5;
  color: #fff;
  margin: 5px auto 10px;
  font-size: 16px;
  font-weight: 300;
  text-transform: capitalize;
}

.btn-default:hover{
  background: #0288D1;
  border-color: #0277BD;
}

.btn-default:focus {
  border-color: #0277BD;
}
.btn-default:active {
  background: #0277BD;
  border-color: #01579B;
  outline: 0;
  -webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
  box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}

.btn-default[disabled] {
  cursor: not-allowed;
  filter: alpha(opacity=65);
  -webkit-box-shadow: none;
  box-shadow: none;
  opacity: .65;
}
.btn-reset {
  float: right;
  font-weight: 300;
}
.terms_heading {
  font-size: 20px;
  font-weight: 400;
}
.initial {
  margin: 0 0 30px;
}
.second {
  margin: 0 0 10px;
}
.terms_subheading {
  font-weight: 300;
  margin: 0 0 25px;
  line-height: 1.5;
  letter-spacing: 0.5px;
}
.terms_heading,
.terms_link {
  color: #039BE5;
  cursor: pointer;
}
.terms_input {
  position: relative;
  background-color: #fdfdfd;
  border: 1px solid #d0d1d5;
  border-radius: 3px;
  padding: 9px 8px 7px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
}
.card {
  width: 323px;
  position: relative;
  top: 50%;
  margin: -200px auto 0;
}
.btn-nofill {
  border: 1px solid #d3d6db;
  color: #A2A3A7;
  width: 100%;
  font-weight: 300;
  margin: 18px 0 0;
}
              
            
!

JS

              
                let { Component, PropTypes } = React;
let ReactCSSTransitionGroup = React.addons.CSSTransitionGroup
let ReactTransitionGroup = React.addons.TransitionGroup;
let assign = _.assign;

class Track extends Component {
  constructor(props) {
    super(props);
  }
  
  render() {
    let reset = this.props.reset || false;
    const count = this.props.children.length;
    let transition = ((this.props.currentView == 0) ? 'transform' : 'transform .3s ease-in-out');
    const selectedIndex = ((this.props.currentView+1) >= count) 
      ? (count-1) 
      : this.props.currentView;
    const pageWidthPercent = 100 / this.props.children.length;
    const translation = selectedIndex * pageWidthPercent;
    const viewsStyle = {
      transform: 'translate3d(-' + translation + '%, 0, 0)',
      WebkitTransform: 'translateX(-' + translation + '%)',
      transition: transition,
      width: this.props.children.length * 100 + '%',
    };
    
    let views = this.props.children.map((elem, i) => {
      return React.cloneElement(elem, {
        key: i,
        className: 'welcome_view',
        style: {width: pageWidthPercent + '%'}
      });
    });
    return(
      <div 
        className="welcome_track"
        style={viewsStyle}>
        { views }
      </div>
    );
  }
}

class Viewport extends Component {
  render() {
    let trackProps = {
      currentView: this.props.currentView
    }
    return(
      <div ref="viewport" className="welcome_viewport">
        <Track ref="track" {...trackProps}>
          { this.props.children }
        </Track>
      </div>
    );
  }
}

class Welcome extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  render() {
    let viewportProps = {
      currentView: this.props.currentView
    }
    return(
      <div
        ref="views"
        className="welcome_views">
        <Viewport ref="viewport" {...viewportProps}>
          { this.props.children }
        </Viewport>
      </div>
    );
  }
}

class Base extends Component {
  constructor(props) {
    super(props);
    this.state = {
      currentView: 0,
      terms: 'Get Started'
    };
    this.handleTouchStart = this.handleTouchStart.bind(this);
    this.next = this.next.bind(this);
    this.prev = this.prev.bind(this);
    this.reset = this.reset.bind(this);
  }
  
  reset(e) {
    this.setState({
      currentView: 0,
      terms: 'Continue'
    });
  }
  
  next(e) {
    console.log('next');
    this.setState({
      currentView: this.state.currentView + 1
    });
  }
  
  prev(e) {
    console.log('prev');
    this.setState({
      currentView: this.state.currentView - 1
    });
  }
  
  handleTouchStart(e) {
    // to enable css on button held on mobile
  }
  
  render() {
    let setup = {
      currentView: this.state.currentView,
    };
    return (
      <main className="app_shell">
        <div className="header">
          <p>Welcome Module</p>
          <button className="btn btn-reset" onClick={this.reset}>Reset</button>
        </div>
        <Welcome {...setup}>
          <div>
            <div className="card">
              <h1 className="terms_heading initial">Join Facebook</h1>
              <p className="terms_subheading">By signing up, you agree to our <span className="terms_link">Facebook</span> Terms and that you read our <span className="terms_link">Privacy Policy</span>, including our <span className="terms_link">Coookie Use</span>. You may receive SMS Notifications from Facebook and can opt-out at any time.
              </p>
              <button 
                onTouchStart={this.handleTouchStart} 
                className="btn btn-default" 
                onClick={this.next}
              >
                {this.state.terms}
              </button>
            </div>
            <div className="footer">
              <span>Already have an account?</span>
            </div>
          </div>
          <div>
            <div className="card">
              <h1 className="terms_heading second">Whats Your Email Address?</h1>
              <input className="terms_input" aria-describedby="errorAlert" aria-required="true" autoCapitalize="off" autoCorrect="off" autoComplete="off" spellCheck="false" id="lfFieldInputEmail" name="email" placeholder="Enter your email" type="text" />
              <button 
                onTouchStart={this.handleTouchStart} 
                className="btn btn-default" 
                onClick={this.next}
              >
                continue
              </button>
              <button className="btn btn-nofill">
                Use your mobile number
              </button>
            </div>
            <div className="footer">
              <span>Already have an account?</span>
            </div>
          </div>
          <div>
            <h1>3</h1>
            <p>some text</p>
            <button 
              onTouchStart={this.handleTouchStart} 
              className="btn btn-default" 
              onClick={this.next}
            >
              continue
            </button>
            <div className="footer">
              <span>Already have an account?</span>
            </div>
          </div>
        </Welcome>
      </main>
    );
  }
}

ReactDOM.render(
  <Base />,
  document.getElementById('root')
);
              
            
!
999px

Console