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

              
                *{
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
  font-family: sans-serif;
  background-color: #121f3d;
}

.entry{
  width: 300px;
  height: auto;
  border-radius: 10px;
  background-color: #24385b;
  color: #FFF;
}

.entry--header{
  width: 100%;
  height: 120px;
}

.entry--header img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.entry--body{
  padding: 15px 15px 5px 15px;
}

.entry--body .entry--title h2{
  font-size: 18px;
  font-weight: 400;
}

.entry--body .entry--author, .entry--body .entry--details{
  display: flex;
  align-items: flex-end;
}

.entry--details{
  margin: 10px 0;
}

.entry--body .entry--author .author--img{
  width: 30px;
  height: 30px;
  margin-right: 10px;
  border-radius: 50%;
  object-fit: cover;
}

.entry--resume{
  padding: 10px;
  color: rgba(255, 255, 255, 0.8);
  border-left: 4px solid gray;
}

.entry--author{
  margin-right: 10px;
}

.entry--author::after{
  content: '.';
  height: 25px;
  font-size: 20px;
  opacity: 0.6;
}

.entry--date{
  margin-left: 10px;
  opacity: 0.6;
  font-size: 13px;
}

.entry--details .author--details{
  font-size: 12px;
}


.author--details .author--name{
  text-transform: capitalize;
  font-weight: 600;
}

.author--details .author--rol{
  margin-top: 2px;
  color: #98ca3f;
  font-weight: 600;
  text-transform: capitalize;
}


.entry--footer{
  border-top: 2px solid rgba(0, 0, 0, 0.1);  
  margin-top: 15px;
  padding-top: 15px;
}

.entry--stats{
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
}

.entry--stats .entry--likes{
  margin-right: 10px;
}

.entry--footer .entry--tags{
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
}

.entry--footer .entry--tags span{
  border: 1px solid black;
  border-radius: 15px;
  color: rgba(255, 255, 255, 0.725);
  margin: 0 9px 9px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.125);
}

              
            
!

JS

              
                const BlogEntry = ({ img, title, author, resume, time, likes_count, comments_count, tags }) => {
  return(
    <article className="entry">
      <div className="entry--header">
        <img src={img} alt="blog" />
      </div>
      <div className="entry--body">
        <div className="entry--title">
          <h2>{title}</h2>
        </div>
        {resume && <div className="entry--resume">
          <p  >{resume}</p>
        </div>}
        <div className="entry--details">
          <div className="entry--author">
            <img src={author.img} alt={author.name} className="author--img" />
            <div className="author--details">
              <p className="author--name">{author.name}</p>
              <p className="author--rol">Platzi {author.rol ? author.rol : "Team"}</p>
            </div>
          </div>
          <div className="entry--date">
            <span>{time.getFullYear()}</span>
          </div>
        </div>
      <div className="entry--footer">
        <div className="entry--stats">
          <span className="entry--likes">{likes_count} likes</span>
          <span>{comments_count} comments</span>
        </div>
        <div className="entry--tags">
          {tags.map((tag, id) => <span key={id} >{tag}</span>)}
        </div>
      </div>
      </div>
    </article>
  )
}

BlogEntry.propTypes = {
  img: PropTypes.string,
  title: PropTypes.string.isRequired,
  resume: PropTypes.string,
  author: PropTypes.shape({
    name: PropTypes.string,
    rol: PropTypes.oneOf(["student", "teacher", "team"]),
    img: PropTypes.string
  }).isRequired,
  time: PropTypes.instanceOf(Date).isRequired,
  likes_count: PropTypes.oneOfType([
    PropTypes.number,
    PropTypes.string
  ]).isRequired,
  comments_count: PropTypes.oneOfType([
    PropTypes.number,
    PropTypes.string,
  ]).isRequired,
  tags: PropTypes.arrayOf(PropTypes.string).isRequired
}

const data = {
  img: "https://static.platzi.com/media/blog/blog-_fernanda-machado-cover-512e1c7f-66d0-4069-8b7c-df7cfd05ae98.png",
  title: "Practica portugués e inglés con Fernanda Machado",
  author: {
    name: "Carolina boquin",
    img: "https://static.platzi.com/media/avatars/avatars/carolina-boquin-espirilla_0136426c-82cf-402b-a58e-b925930ef5f9.JPG",
    // rol: "teacher"
  },
  // resume: 'Lorem ipsum lorem ipsum lorem ipsum',
  time: new Date(),
  likes_count: 42,
  comments_count: "5",
  tags: ["English", "Development", "Soft skills"]
}

ReactDOM.render( <BlogEntry {...data} />, document.getElementById("App"))

              
            
!
999px

Console