<commit_before>'use strict'
import React, { Component } from 'react' // eslint-disable-line
import styled from 'styled-components'

const Bar = styled.div`
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  background-color: rgba(198, 0, 11, 0.35);
  height: 2px;
  width: ${(props) => { return props.percent + '%'}}
`

class ReadingProgress extends React.PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      percent: props.percent
    }
    this.updatePercentage = this._updatePercentage.bind(this)
  }

  componentWillReceiveProps(nextProps) {
    this.setState({
      percent: nextProps.percent
    })
  }

  _updatePercentage(percent) {
    if (typeof percent === 'number') {
      this.setState({
        percent
      })
    }
  }

  render() {
    const { percent } = this.state
    return (
      <Bar percent={percent} /><commit_msg>Add reading progress transition<commit_after>'use strict'
import React, { Component } from 'react' // eslint-disable-line
import styled from 'styled-components'

const Bar = styled.div`
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  background-color: rgba(198, 0, 11, 0.35);
  height: 2px;
  width: ${(props) => { return props.percent + '%'}};
  transition: .2s width linear;
`

class ReadingProgress extends React.PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      percent: props.percent
    }
    this.updatePercentage = this._updatePercentage.bind(this)
  }

  componentWillReceiveProps(nextProps) {
    this.setState({
      percent: nextProps.percent
    })
  }

  _updatePercentage(percent) {
    if (typeof percent === 'number') {
      this.setState({
        percent
      })
    }
  }

  render() {
    const { percent } = this.state
    return (
      <Bar percent={percent} />
{'fraction_non_alphanumeric': 0.13392363032650803, 'fraction_numerical': 0.01715550636413946, 'mean_word_length': 2.9219088937093276, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7647629', 'n_tokens_mistral': 613, 'n_tokens_neox': 577, 'n_words': 133}