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

              
                #disclaimer
  h1 This is not your regular comment section
  p This looks like a comment section, feels like a comment section, but nothing you write there will make it outside of your computer. You will keep seeing your comments, but there will be a little less noise on the web.
#root
              
            
!

CSS

              
                html,
body
  width: 100%
  height: 100%
  margin: 0
  padding: 0
  background-color: rgb(50, 51, 59)

#disclaimer
  max-width: 650px
  margin: 20px auto
  color: #CCCCCC
  font-family: sans-serif
#root
  padding: 20px
  
.comments-void__form
  max-width: 800px
  margin: 40px auto

.comments-void__form-name
  display: inline-block
  width: 100%
  height: 30px
  border: 1px solid coral
  border-top-left-radius: 5px
  background-color: transparent
  color: white
  padding: 5px 10px
  margin: 0
  box-sizing: border-box
  font-size: 16px
  font-family: sans-serif

.comments-void__form-comment
  display: inline-block
  width: 100%
  height: 70px
  border: 1px solid coral
  border-top: none
  border-bottom-left-radius: 5px
  background-color: transparent
  color: white
  padding: 5px 10px
  margin: 0
  box-sizing: border-box
  resize: none
  font-size: 16px
  font-family: sans-serif
  
.comments-void__form
  fieldset
    display: inline-block
    box-sizing: border-box
    width: calc(85% - 2px)
    vertical-align: top
    padding: 0
    margin: 0
    border: none
  button
    display: inline-block
    box-sizing: border-box
    width: calc(15% - 2px)
    height: 100px
    vertical-align: top
    background-color: coral
    color: rgb(50, 51, 59)
    padding: 0
    margin: 0
    border: none
    border-top-right-radius: 5px
    border-bottom-right-radius: 5px
    cursor: pointer
    font-family: sans-serif
    font-size: 18px
    font-weight: bold
    &:hover
      background-color: #ff7f50
  
.comments-void__list
  list-style: none
  max-width: 800px
  margin: 40px auto
  padding: 5px 10px
  box-sizing: border-box
  text-align: left
  color: #ccc
  
.comments-void__list-item
  margin: 0
  padding: 5px
  box-sizing: border-box
  font-family: sans-serif
  &:hover
    background-color: rgba(255,255,255,0.1)
  span
    margin: 0
    padding: 0
    box-sizing: border-box
    margin-right: 20px
    font-weight: bold
              
            
!

JS

              
                class CommentForm extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      comment: '',
      author: ''
    }

    this.handleChange = this.handleChange.bind(this)
    this.handleSubmit = this.handleSubmit.bind(this)
  }

  handleChange(event) {
    this.setState({
      [event.target.name]: event.target.value
    })
  }

  handleSubmit(event) {
    event.preventDefault()
    this.props.post({author: this.state.author, content: this.state.comment})
    this.setState({comment: ''})
  }

  render() {
    return (
      <form className="comments-void__form" onSubmit={this.handleSubmit}>
        <fieldset>
          <input name="author" className="comments-void__form-name" placeholder="Your name" onChange={this.handleChange} value={this.state.author} />
          <textarea name="comment" className="comments-void__form-comment" placeholder="Your comment here..." onChange={this.handleChange} value={this.state.comment}></textarea>
        </fieldset>
        <button>Send</button>
      </form>
    )
  }
}

class Comment extends React.Component {
  render() {
    return <li className="comments-void__list-item"><span>{this.props.author}</span> {this.props.comment}</li>
  }
}

class CommentsList extends React.Component {
  render() {
    return (
      <ul className="comments-void__list">
        {this.props.comments.map((comment, index) =>
          <Comment key={index} author={comment.author} comment={comment.content} />
        )}
      </ul>
    )
  }
}

class CommentIntoTheVoid extends React.Component {
  constructor(props) {
    super(props)

    let comments = localStorage.getItem('comments') ?
      JSON.parse(localStorage.getItem('comments')) :
      []

    this.state = {comments: comments}

    this.postComment = this.postComment.bind(this)
  }

  postComment(newComment) {
    let comments = this.state.comments
    comments.push(newComment)
    this.setState({comments: comments})
    localStorage.setItem('comments', JSON.stringify(comments))
  }

  render() {
    return (
      <div className="comments-void">
        <CommentForm post={this.postComment} />
        <CommentsList comments={this.state.comments} />
      </div>
    )
  }
}

ReactDOM.render( 
  <CommentIntoTheVoid />,
  document.getElementById('root')
)
              
            
!
999px

Console