Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


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.


                <div id="content"></div>


                * {
  font-family: Roboto;
  font-weight: 300;
  font-size: 1rem;

body {
  background: no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-image: url('');
  background-color: #CCCCCC;

h1 {
  font-family: "Shadows Into Light";
  text-align: center;
  font-size: 10rem;
  color: #2C2416;

a {
  text-decoration: none;

.mdl-layout__content {
  width: 100%;

span.highlighted {
  background-color: lightgreen;

/* Following CSS is for the search bar,
 * from

input {
	outline: none;

input[type=search] {
	-webkit-appearance: textfield;
	-webkit-box-sizing: content-box;
	font-family: inherit;
	font-size: 100%;

input::-webkit-search-cancel-button {
	display: none; 

input[type=search] {
	background: #ededed url( no-repeat 9px center;
	border: solid 1px #ccc;
	padding: 9px 10px 9px 32px;
	width: 55px;
	-webkit-border-radius: 10em;
	-moz-border-radius: 10em;
	border-radius: 10em;
	-webkit-transition: all .5s;
	-moz-transition: all .5s;
	transition: all .5s;

input[type=search]:focus {
	width: 130px;
	background-color: #fff;
	border-color: #66CC75;
	-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
	-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
	box-shadow: 0 0 5px rgba(109,207,246,.5);

input:-moz-placeholder {
	color: #999;
input::-webkit-input-placeholder {
	color: #999;


                class CamperNews extends React.Component {
  constructor(props) {
    this.state = {data: [], search: ''};
  componentDidMount() {
    $.getJSON(this.props.url, data => this.setState({data}));
  searchArticles = (search) => {
  render() {
    const data = => {
      return ~article.headline.toLowerCase().indexOf(;
    return <div>
      <h1>Camper News</h1>
      <SearchBar onSearch={this.searchArticles} />
      <ArticleList data={data} search={} />

class SearchBar extends React.Component {
  handleInput = (e) => {
  render() {
    const style = {textAlign: 'center', marginTop: '-1.5rem', marginBottom: '1rem'};
    return <div style={style}>

class ArticleList extends React.Component {
  render() {
    var articles = => {
      return <Article data={article} search={} key={article._id} />
    return <main className="mdl-layout__content">
      <div className="mdl-grid">

class Article extends React.Component {
  render() {
    return <div className="mdl-card mdl-shadow--4dp mdl-cell mdl-cell--4-col">
      <a href={} target="_blank">
        <ArticleMedia data={} />
        <ArticleText data={} search={} />
class ArticleMedia extends React.Component {
  render() {
    const {data} = this.props;
    const image = data.image || '';
    const style = {backgroundImage: 'url(' + image + ')', height: '21rem'};
    const upVotesStyle = {
      width: '4.6rem',
      height: '2.3rem',
      lineHeight: '2.3rem',
      textAlign: 'center',
      backgroundColor: '#666',
      color: '#fafafa',
      opacity: '0.65'
    return <div className="mdl-card__media" style={style}>
      <div style={upVotesStyle}>
class ArticleText extends React.Component {
  render() {
    const {search} = this.props;
    const re = new RegExp(search, 'gim');
    let {headline} =;
    if (search) headline = headline.replace(re, '<span class="highlighted">$&</span>');
    return <div className="mdl-card__supporting-text meta mdl-color-text--grey-600">
      <div dangerouslySetInnerHTML={{__html: headline}} />

  <CamperNews url="" />,