Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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="app"></div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,700');

$borderRadius: 1px;
$offset: 150%;
$inputHeight: 63px;
$transitionEasing: cubic-bezier(.36,1,.62,.98);

$background1: #433B7C;
$background2: #2C497F;

// $yellow: #FF6542;
$yellow: #ED6A5E;

@mixin box-shadow($props...) {
    -webkit-box-shadow: $props;
    -moz-box-shadow: $props;
    box-shadow: $props;
}

@mixin border-radius($radius) {
    -webkit-border-radius: $radius;
    -moz-border-radius: $radius;
    border-radius: $radius;
}

@mixin transition($transition...) {
    -moz-transition: $transition;
    -webkit-transition: $transition;
    transition: $transition;
}

html, body, .container, #app {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    color: #fff;
    margin: 0 !important;
}

.app {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    overflow-y: scroll;
    background-image: url('https://unsplash.it/1366/768?image=568');
    background-repeat: no-repeat;
    background-size: cover;
}

.form-block-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    @include transition(all .85s ease-in-out);
    &--is-login {
        opacity: .92;
        background-color: $background2;
    }
    &--is-signup {
        opacity: .94;
        background-color: $background1;
    }
}

.form-block {
    position: relative;
    margin: 100px auto 0;
    width: 285px;
    padding: 25px;
    background: rgba(255, 255, 255, .13);
    border-radius: 2 * $borderRadius;
    color: #fff;
    @include box-shadow(0px 0px 16px 9px rgba(0,0,0,0.07));
}

.form-block__header {
    margin-bottom: 20px;
    h1 {
        font-size: 30px;
        margin: 0 0 20px;
    }
}

.form-block__toggle-block {
    position: relative;
    span {
        font-size: 13px;
        font-weight: 300;
        color: rgba(255,255,255,.65);
    }
}

.form-block__input-wrapper {
    height: 2 * $inputHeight;
    position: relative;
    margin-bottom: 2px;
    @include transition(all .25s $transitionEasing .3s);
    .form-block--is-signup & {
        height: 4 * $inputHeight;
        @include transition(all .5s $transitionEasing .2s);
    }
}

.form-group {
    &--signup {
        position: absolute;
        top: 0;
        left: $offset;
        width: 100%;
    }
}

.form-group__input {
    display: block;
    font-size: 15px;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    padding: 14px 10px;
    margin-bottom: 15px;
    background: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: $borderRadius;
    &:focus {
        outline: none;
        border: 1px solid #fff;
        background: transparent;
    }
    .form-block--is-signup & {
        transform: translateX(-$offset);
    }
    .form-group--login & {
        opacity: 1;
        .form-block--is-signup & {
            opacity: 0;
        }
    }
    .form-group--signup & {
        opacity: 0;
        .form-block--is-signup & {
            opacity: 1;
        }
    }
}

@for $i from 1 through 4 {
    .form-group__input:nth-of-type(#{$i}) {
        @include transition(transform .35s $transitionEasing $i*.085s, opacity .3s ease-in-out .2s, background .15s ease-in-out, border .3s ease-in-out);
    }
}

.button {
    display: inline-block;
    padding: 15px 12px;
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 400;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    background-image: none;
    border: none;
    border-radius: 2 * $borderRadius;
    @include transition(all .2s ease-in-out);
    @include box-shadow(0px 0px 13px 8px rgba(0,0,0,0.1));
    &--primary {
        background: $yellow;
        color: #fff;
    }
    &:hover {
        @include box-shadow(0px 0px 18px 15px rgba(0,0,0,0.15));
    }
}

.full-width {
    width: 100%;
}

input[type="checkbox"] {
    display: none;
    + label {
        &:before {
            content: '';
            display: block;
            position: absolute;
            top: 10px;
            right: 0;
            width: 43px;
            height: 8px;
            background: rgba(255, 255, 255, .4);
            cursor: pointer;
            @include border-radius(50px);
        }
        &:after {
            content: '';
            display: block;
            position: absolute;
            top: 1px;
            right: 18px;
            width: 25px;
            height: 25px;
            background: $yellow;
            cursor: pointer;
            @include border-radius(50%);
            @include box-shadow(1px 1px 0px 0px rgba(0,0,0,0.15));
            @include transition(all .3s ease-in-out);
        }
    }
    &:checked + label:after {
        right: 0;
    }
}

::-webkit-input-placeholder { /* Chrome/Opera/Safari */
    font-weight: 300;
    color: rgba(255, 2505, 255, .5);
}
::-moz-placeholder { /* Firefox 19+ */
    font-weight: 300;
    color: rgba(255, 255, 255, .5);
}
:-ms-input-placeholder { /* IE 10+ */
    font-weight: 300;
    color: rgba(255, 255, 255, .5);
}
:-moz-placeholder { /* Firefox 18- */
    font-weight: 300;
    color: rgba(255, 255, 255, .5);
}

.tooltip {
    padding: 7px;
    @include border-radius(1px);
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 12px;
    position: absolute;
    top: -10px;
    right: 0
}

              
            
!

JS

              
                const mode = 'login';

class LoginComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            mode: this.props.mode
        }
    }
    toggleMode() {
        var newMode = this.state.mode === 'login' ? 'signup' : 'login';
        this.setState({ mode: newMode});
    }
    render() {
        return (
            <div>
                <div className={`form-block-wrapper form-block-wrapper--is-${this.state.mode}`} ></div>
                <section className={`form-block form-block--is-${this.state.mode}`}>
                    <header className="form-block__header">
                        <h1>{this.state.mode === 'login' ? 'Welcome back!' : 'Sign up'}</h1>
                        <div className="form-block__toggle-block">
                            <span>{this.state.mode === 'login' ? 'Don\'t' : 'Already'} have an account? Click here &#8594;</span>
                            <input id="form-toggler" type="checkbox" onClick={this.toggleMode.bind(this)} />
                            <label htmlFor="form-toggler"></label>
                        </div>
                    </header>
                    <LoginForm mode={this.state.mode} onSubmit={this.props.onSubmit} />
                </section>
            </div>
        )
    }
}

class LoginForm extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        return (
        <form onSubmit={this.props.onSubmit}>
            <div className="form-block__input-wrapper">
                <div className="form-group form-group--login">
                    <Input type="text" id="username" label="user name" disabled={this.props.mode === 'signup'}/>
                    <Input type="password" id="password" label="password" disabled={this.props.mode === 'signup'}/>
                </div>
                <div className="form-group form-group--signup">
                    <Input type="text" id="fullname" label="full name" disabled={this.props.mode === 'login'} />
                    <Input type="email" id="email" label="email" disabled={this.props.mode === 'login'} />
                    <Input type="password" id="createpassword" label="password" disabled={this.props.mode === 'login'} />
                    <Input type="password" id="repeatpassword" label="repeat password" disabled={this.props.mode === 'login'} />
                </div>
            </div>
            <button className="button button--primary full-width" type="submit">{this.props.mode === 'login' ? 'Log In' : 'Sign Up'}</button>
        </form>
        )
    }
}

const Input = ({ id, type, label, disabled }) => (
    <input className="form-group__input" type={type} id={id} placeholder={label} disabled={disabled}/>
);

const App = () => (
    <div className={`app app--is-${mode}`}>
        <LoginComponent
            mode={mode}
            onSubmit={
                function() {
                    console.log('submit');
                }
            }
        />
    </div>
);

ReactDOM.render( <App/>, document.getElementById("app"));


              
            
!
999px

Console