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

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Space+Mono:400,700,400i,700i');

html,
body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 100%;
}

body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  
  background: #191f24;
  color: #d1dfea;
  font-family: 'Space Mono', monospace;
  
  a {
    color: #FFFFFF;
  }
}

@media screen and (prefers-color-scheme: light) {
  
  body {
    background-color: #d1dfea;
    color: #191f24;
    
    a {
      color: #161616;
    }
  }
}

$line-height: 1.5;
$weight-bold: 700;

#root {
  margin: auto auto;
  padding: 40px 0 80px; // WHY: Offets the logo’s visual centering
  width: 80%;
  max-width: 84ch;
}

.logo {
  height: 30px;
  width: 25px;
  margin: 0 0 20px;
}

.text {
  line-height: $line-height;
  max-width: 52ch;
  
  strong {
    font-weight: $weight-bold;
  }
  
  em {
    font-style: italic;
  }
  
  &-wrapper {
    
    > span {
      display: block;
      margin: 0.75em;
    }
    
    .text-caret {
      display: none;
    }
  }
  
  &-caret {
    // animation: blink 1s steps(1, end) infinite;
    animation: blink 1000ms steps(2, start) infinite;
    opacity: 0.5;
    font-weight: 600;
    
    @keyframes blink {
      to {
        // opacity: 0;
        visibility: hidden;
        // transform: rotate(360deg);
      }
    }
  }
}
              
            
!

JS

              
                const Logo = (props) => {
  return (
    <svg
        className="logo"

        width="100%"
        height="100%"
        xmlns="http://www.w3.org/2000/svg"
        xmlnsXlink="http://www.w3.org/1999/xlink"
        viewBox="0 0 25 30"
    >
      <path
        fill-rule="evenodd"
        fill="currentColor"
        d="M21 7v1h2v2l-1 1v3l1 1v9h-2V14l-1-1h-2V3l-3-3H5L2 3v25H0v2h20v-2h-2V14h2v10l1 1h2l1-1v-9l1-1V9l-2-2h-2zm-5 6H4V3l1-1h10l1 1v10z"
      />
    </svg>
  );
}


class TypeWriter extends React.Component {
  typeEffect = React.createRef();

  componentDidMount() {
    const longPause = 1000;
    const shortPause = 500;
    const deleteDelay = 15;
    const typeDelay = 8;
    
    const config = {
      delay: typeDelay,
      wrapperClassName: `text-wrapper`,
      cursorClassName: `text-caret`,
    };
    
    const wrapper = this.typeEffect.current;
    const typewriter = new Typewriter(wrapper, config);

    const clients = [
      `games for Apple`,
      `popup markets for Popshop`,
      `unusual dating apps for Apartner`,
      `an indie games portal for Bigpoint`,
      `web apps for Avingo nurses`,
      `backend systems for MGM`,
    ];
    
    const shuffledClients = window.knuthShuffle(clients.slice(0));
    
    typewriter
      .changeDeleteSpeed(deleteDelay)
      .typeString(`Hi interested internet-<em>er</em>!`)
      .pauseFor(longPause)
      .typeString(`<span> </span>We’re the Web Engineering team at <a href="https://fueled.com">Fueled</a>.`)
      .pauseFor(shortPause)
      .typeString(`<span> </span>We build web <em>things</em>…`)
      .pauseFor(longPause)
      .deleteChars(18)
      .typeString(`’ve built `);
    
    shuffledClients.forEach(client => {
      console.log(client, client.length);
      typewriter
        .typeString(`<strong>${client}.<strong>`)
        .pauseFor(shortPause)
        .deleteChars(client.length + 1);
    });
    
    const jobsUrl = label => `<a href="https://fueled.com/jobs">${label}</a>`;
    
    typewriter
      .deleteChars(15)
      .typeString(`The internet ain’t shrinking, there’s so much more to be built…`)
      .pauseFor(longPause)
      .typeString(`<span> </span>Want in?`)
      .pauseFor(shortPause)
      .typeString(` ${jobsUrl(`We’re hiring!`)}`)
      .pauseFor(5000)
      .deleteChars(22)
      .typeString(`What are you waiting for?`)
      .pauseFor(shortPause)
      .typeString(` ${jobsUrl(`Join the team!`)}`);
    
    typewriter.start();
  };
  
  render() {
    return <div class="text" ref={this.typeEffect}>{this.props.text}</div>;
  };
};

class App extends React.Component {
  render() {
    return (
      <React.Fragment>
        <Logo fill="violet" />
        <TypeWriter />
      </React.Fragment>
    );
  };
}

ReactDOM.render(
  <App />,
  document.getElementById('root')
);

              
            
!
999px

Console