clear filter x
This commit is contained in:
parent
46c7142750
commit
1a69eb21b0
@ -16,6 +16,7 @@ $scale: 4;
|
|||||||
// sprites from https://pokemondb.net/sprites
|
// sprites from https://pokemondb.net/sprites
|
||||||
// alolan sprites from https://www.pokecommunity.com/showthread.php?t=368703
|
// alolan sprites from https://www.pokecommunity.com/showthread.php?t=368703
|
||||||
// TODO: check and update from https://github.com/ZeChrales/PogoAssets/tree/master/pixels
|
// TODO: check and update from https://github.com/ZeChrales/PogoAssets/tree/master/pixels
|
||||||
|
// TODO: add missing forms from https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_with_form_differences#In_other_languages
|
||||||
.pokemon-001,
|
.pokemon-001,
|
||||||
.pokemon-002,
|
.pokemon-002,
|
||||||
.pokemon-003,
|
.pokemon-003,
|
||||||
|
|||||||
@ -236,7 +236,7 @@ export class PokemonExplorer extends React.Component<IPokemonExplorerProps, ISta
|
|||||||
<i className={ pokemonIconCss } />
|
<i className={ pokemonIconCss } />
|
||||||
<h4 className={ styles.dexHeader }>No.{ dex }</h4>
|
<h4 className={ styles.dexHeader }>No.{ dex }</h4>
|
||||||
{ leaguePokemon.form &&
|
{ leaguePokemon.form &&
|
||||||
<h6 className={ styles.formHeader }>{ leaguePokemon.form.toLowerCase().replace('_', ' ') } Forme</h6>
|
<h6 className={ styles.formHeader }>{ leaguePokemon.form.toLowerCase().replace('_', ' ') } Form</h6>
|
||||||
}
|
}
|
||||||
<div className={ styles.pokemonTypeWrapper }>
|
<div className={ styles.pokemonTypeWrapper }>
|
||||||
{ type1 }
|
{ type1 }
|
||||||
|
|||||||
@ -77,6 +77,7 @@ export class PokemonSelectList extends React.Component<IPokemonSelectListProps,
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="pokemon-select-list" className={ wrapperCss }>
|
<div id="pokemon-select-list" className={ wrapperCss }>
|
||||||
|
<div className={ styles.filterWrapper }>
|
||||||
<input
|
<input
|
||||||
name="filter"
|
name="filter"
|
||||||
type="text"
|
type="text"
|
||||||
@ -85,6 +86,13 @@ export class PokemonSelectList extends React.Component<IPokemonSelectListProps,
|
|||||||
value={ this.props.filterTerm }
|
value={ this.props.filterTerm }
|
||||||
placeholder="Pokemon Name"
|
placeholder="Pokemon Name"
|
||||||
/>
|
/>
|
||||||
|
{ this.props.filterTerm !== '' &&
|
||||||
|
<i
|
||||||
|
className="nes-icon close is-small"
|
||||||
|
onClick={ this.handleClickClearFilter }
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<div className={ listWrapperCss }>
|
<div className={ listWrapperCss }>
|
||||||
{ listLength > 0 &&
|
{ listLength > 0 &&
|
||||||
<Measure
|
<Measure
|
||||||
@ -157,7 +165,7 @@ export class PokemonSelectList extends React.Component<IPokemonSelectListProps,
|
|||||||
<span>{ pokemon.name }</span>
|
<span>{ pokemon.name }</span>
|
||||||
<span className={ dexCss }>#{ dex }</span>
|
<span className={ dexCss }>#{ dex }</span>
|
||||||
{ pokemon.form &&
|
{ pokemon.form &&
|
||||||
<span className={ formCss }>{ pokemon.form.toLowerCase().replace('_', ' ') } Forme</span>
|
<span className={ formCss }>{ pokemon.form.toLowerCase().replace('_', ' ') } Form</span>
|
||||||
}
|
}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
@ -171,4 +179,13 @@ export class PokemonSelectList extends React.Component<IPokemonSelectListProps,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly handleClickClearFilter = () => {
|
||||||
|
this.props.handleChangeFilter('')
|
||||||
|
.then(() => {
|
||||||
|
if (this.listRef.current !== null) {
|
||||||
|
this.listRef.current.resetAfterIndex(0, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,9 +36,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filterWrapper {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
:global(.close) {
|
||||||
|
position: absolute;
|
||||||
|
top: 1em;
|
||||||
|
right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.filterInput {
|
.filterInput {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
padding-right: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dex,
|
.dex,
|
||||||
|
|||||||
@ -4,6 +4,7 @@ export const dex: string;
|
|||||||
export const emptyList: string;
|
export const emptyList: string;
|
||||||
export const emptyState: string;
|
export const emptyState: string;
|
||||||
export const filterInput: string;
|
export const filterInput: string;
|
||||||
|
export const filterWrapper: string;
|
||||||
export const form: string;
|
export const form: string;
|
||||||
export const leftPanel: string;
|
export const leftPanel: string;
|
||||||
export const listWrapper: string;
|
export const listWrapper: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user