<commit_before>import React, { Component } from 'react';
import { AutoSizer, List } from 'react-virtualized';

import maleIcon from '../assets/male.png';
import femaleIcon from '../assets/female.png';

/**
 * NameList Component.
 */
class NameList extends Component {
  rowRenderer = ({ key, index, style }) => {
    const { names } = this.props;

    return (
      <div key={key} style={style}>
        <li className="collection-item avatar">
          <img
            src={names[index].gender === 'male' ? maleIcon : femaleIcon}
            alt="avatar"
            className="circle"
          />
          <span className="title">{names[index].name}</span>
          <p className="secondary-title">
            {names[index].gender.charAt(0).toUpperCase() +
              names[index].gender.slice(1)}
          </p>
        </li>
      </div>
    );
  };

  noRowsRenderer = () => {
    return (
      <li className="collection-item center">
        {this.props.isLoading ? (
          <div className="loading">
            <i
              className="fa fa-refresh fa-fw"
              title="Refresh"
              aria-hidden="true"
            />{' '}
            Loading...
          </div>
        ) : (
          <div>
            <i
              className="fa fa-exclamation-circle fa-fw"
              title="Warning"
              aria-hidden="true"
            />{' '}
            Nothing to show.
          </div>
        )}
      </li>
    );
  };

  render() {
    const { names, total } = this.props;

    return (
      <div>
        {this.props.isLoading ? (
          ''
        ) : (
          <p className="small grey-text text-darken-1 right-align">
            Showing {names.length} of {total} names
          </p>
        )}
        <ul className="collection">
          <AutoSizer disableHeight>
            {({ width }) => (
              <List
                width={width}
                height={570}
                rowCount={names.length}
                rowHeight={70}
                noRowsRenderer={this.noRowsRenderer}
                rowRenderer={this.rowRenderer}
              />
            )}
          </AutoSizer>
        </ul>
      </div>
    );
  }
}

export default NameList;<commit_msg>Use window innerHeight to dynamically set list height<commit_after>import React, { Component } from 'react';
import { AutoSizer, List } from 'react-virtualized';

import maleIcon from '../assets/male.png';
import femaleIcon from '../assets/female.png';

/**
 * NameList Component.
 */
class NameList extends Component {
  rowRenderer = ({ key, index, style }) => {
    const { names } = this.props;

    return (
      <div key={key} style={style}>
        <li className="collection-item avatar">
          <img
            src={names[index].gender === 'male' ? maleIcon : femaleIcon}
            alt="avatar"
            className="circle"
          />
          <span className="title">
            {names[index].name}
          </span>
          <p className="secondary-title">
            {names[index].gender.charAt(0).toUpperCase() +
              names[index].gender.slice(1)}
          </p>
        </li>
      </div>
    );
  };

  noRowsRenderer = () => {
    return (
      <li className="collection-item center">
        {this.props.isLoading
          ? <div className="loading">
              <i
                className="fa fa-refresh fa-fw"
                title="Refresh"
                aria-hidden="true"
              />{' '}
              Loading...
            </div>
          : <div>
              <i
                className="fa fa-exclamation-circle fa-fw"
                title="Warning"
                aria-hidden="true"
              />{' '}
              Nothing to show.
            </div>}
      </li>
    );
  };

  render() {
    const { names, total } = this.props;

    return (
      <div>
        {this.props.isLoading
          ? ''
          : <p className="small grey-text text-darken-1 right-align">
              Showing {names.length} of {total} names
            </p>}
        <ul className="collection">
          <AutoSizer disableHeight>
            {({ width }) =>
              <List
                width={width}
                height={window.innerHeight - 220}
                rowCount={names.length}
                rowHeight={70}
                noRowsRenderer={this.noRowsRenderer}
                rowRenderer={this.rowRenderer}
              />}
          </AutoSizer>
        </ul>
      </div>
    );
  }
}

export default NameList;
{'fraction_non_alphanumeric': 0.14112458654906285, 'fraction_numerical': 0.0035281146637265713, 'mean_word_length': 1.4179104477611941, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 61, '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': '4091218', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1230, 'n_words': 247}