Skip to content

Commit

Permalink
remove <List> stateless functional component
Browse files Browse the repository at this point in the history
  • Loading branch information
carloluis committed May 22, 2018
1 parent 1bca94f commit 079132d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 258 deletions.
40 changes: 0 additions & 40 deletions src/suggestor/List.jsx

This file was deleted.

24 changes: 18 additions & 6 deletions src/suggestor/Suggestor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { autoBind, keys, noop } from '../utils';
import transform from '../utils/transform';
import List from './List';
import ListItem from './ListItem';

class Suggestor extends PureComponent {
constructor(props) {
Expand Down Expand Up @@ -161,6 +161,7 @@ class Suggestor extends PureComponent {
render() {
const { classSchema, style, placeholder, arrow, close, tooltip, required } = this.props;
const { open, value, index, filtered } = this.state;
const displaySuggestions = open && !!filtered.length;

return (
<div className={classSchema.root} onClick={this.handleClick} onKeyDown={this.handleKeyDown} style={style}>
Expand All @@ -176,11 +177,22 @@ class Suggestor extends PureComponent {
/>
{arrow && <span className={classSchema.arrow} />}
{close && value && <span className={classSchema.close} onClick={this.remove} />}
<List
{...{ filtered, index, open, value, classSchema }}
onItemClick={this.handleItemClick}
onItemMouseEnter={this.handleItemMouseEnter}
/>
{displaySuggestions && (
<ul className={classSchema.list}>
{filtered.map((item, i) => (
<ListItem
key={item.word}
classSchema={classSchema}
item={item}
index={i}
onItemClick={this.handleItemClick}
onItemMouseEnter={this.handleItemMouseEnter}
overItem={i === index}
search={value}
/>
))}
</ul>
)}
</div>
);
}
Expand Down
137 changes: 0 additions & 137 deletions src/suggestor/__tests__/List.spec.js

This file was deleted.

75 changes: 0 additions & 75 deletions src/suggestor/__tests__/__snapshots__/List.spec.js.snap

This file was deleted.

0 comments on commit 079132d

Please sign in to comment.