Pen Settings



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


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


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.


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.


                <div id="app"></div>


                .message-info {
  position: relative;
  background: rgba(42,45,50,0.85);
  padding: 22px;
  line-height: 1.4;
  z-index: 1000;
  color: rgba(250,251,255,0.95);
  font-size: 90%;
  font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, sans-serif;
  width: 100%;
  position: absolute;

    position: relative;

      padding: 0.25em 2em 0.25em 3em;

  .button-close {
    background: transparent;
    top: 50%;
    right: 5%;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    position: absolute;
    overflow: hidden;
    text-indent: 100%;
    cursor: pointer;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;

  .button-close::before, .button-close::after {
    -webkit-transform: translate(-50%,-50%) rotate(45deg);
    transform: translate(-50%,-50%) rotate(45deg);
    background: #b7b5b3;
    content: '';
    position: absolute;
    width: 3px;
    height: 60%;
    top: 50%;
    left: 50%;
    background: #FFF;


  .button-close::before {
    -webkit-transform: translate(-50%,-50%) rotate(45deg);
     transform: translate(-50%,-50%) rotate(45deg);
  .button-close::after {
    -webkit-transform: translate(-50%,-50%) rotate(-45deg);
     transform: translate(-50%,-50%) rotate(-45deg);




                //extends the React.Component

class MessageInfo extends React.Component {
   constructor(props) {
    //call to props
    //use let instead of var is more cool
    let active = this.props.statusCode >= 0 && this.props.statusCode <=501 ? true : false;
    //set the state and put the interval to null
    this.state = {active : active}
    this.interval = null;
  //first lifecycle before the component is Mounted

  componentDidMount() {
    this.interval = setInterval(() => {
      this.setState({active: !})
  //we clear the interval when the component is unmounted from the DOM

  componentWillUnmount() {

  handleActive() {
      active: false

  clear() {

//renders the message
  renderMessage() {
    if(  ) {
        <div className='message-info' onClick={this.clear.bind(this)}>
          <div className='message-inner'>
            <p>No se puede establecer la conexión con el servidor. Error {this.props.statusCode}</p>
          <span className="button-close" onClick={this.clear.bind(this)}></span>

    return null

  //calls to renderMesssage

  render() {
    return (


//we defined the propTypes needed for our component

MessageInfo.propTypes = {
  statusCode: React.PropTypes.number.isRequired,
  time: React.PropTypes.number

//we can set the defaultProps

MessageInfo.defaultProps  = {
  time: 1000

//It renders the component in our app wrapper
//You can change the values passed to see if it changes

React.render( <MessageInfo statusCode={200} time={1000} />, document.getElementById('app') );