React

by Oleh Kotsubko

HTML

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

SCSS

body {
  background: #20262E;
}

.list {
  position: relative;
  padding-left: 5px;
  max-width: 200px;
  border: 1px solid;
  
  &__item {
    
    &.active {
      a {
       color: #C52B2E;
      }
    }
    a {
      color: #fff;
      text-decoration: none;
      font-family: sans-serif;
      padding: 5px 15px;
      display: block;
    }
  }
}

#lava-stick {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 28px;
  background: #C52B2E;
  transition: .3s ease;
}

React

class TodoApp extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
    	items: [
      	{ text: "item 1", isActive: true},
       	{ text: "item 2", isActive: false},
        { text: "item 3", isActive: false},
        { text: "item 4", isActive: false},
        { text: "item 5", isActive: false}
      ]
    }
  }
  
  render() {
    return (
      <div>
        <ul class="list">
          <li id="lava-stick" />
          {this.state.items.map(item => (
          <li key={item.id} className={`list__item ${item.isActive ? "active" : ""}`}> {item.text }</li>
        ))}
        </ul>
      </div>
    )
  }
}

ReactDOM.render(<TodoApp />, document.querySelector("#app"))