change button to dropdown

This commit is contained in:
Daniel
2022-02-12 23:32:03 -05:00
parent 045a70a973
commit b330c616cf
4 changed files with 25 additions and 24 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -87,10 +87,8 @@ export default class Home extends React.Component {
localStorage.setItem("extended", this.ext); localStorage.setItem("extended", this.ext);
} }
setStats = () => { setStats = (e) => {
if (this.stats == "min") this.stats = "avg"; this.stats = e.target.value;
else if (this.stats == "avg") this.stats = "max";
else if (this.stats == "max") this.stats = "min";
localStorage.setItem("stats", this.stats); localStorage.setItem("stats", this.stats);
} }
@@ -151,7 +149,7 @@ export default class Home extends React.Component {
}; };
// This is a workaround to allow people interacting with the card list (copy and pasting) to still have focus on the form // This is a workaround to allow people interacting with the card list (copy and pasting) to still have focus on the form
handleOutOfForm = () => { handleOutOfForm = (e) => {
this.formRef.current.focus(); this.formRef.current.focus();
} }
@@ -164,30 +162,33 @@ export default class Home extends React.Component {
<SearchForm formRef={this.formRef} handleContent={this.handleContent} {...this.props} /> <SearchForm formRef={this.formRef} handleContent={this.handleContent} {...this.props} />
</div> </div>
</div> </div>
<div className="right" onClick={this.handleOutOfForm}> <div className="right">
<div className="list-nav-top"> <div className="list-nav-top">
{this.navigation()} {this.navigation()}
<select name="stats-display" value={this.stats} onChange={this.setStats}>
<option value={"min"}>Min Stats</option>
<option value={"avg"}>Average Stats</option>
<option value={"max"}>Max Stats</option>
</select>
<select name="full-card" value={this.ext} onChange={this.setExt}>
<option value={false}>Short Format</option>
<option value={true}>Extended Format</option>
</select>
<div> <div>
<label htmlFor="hide-stats">Hide Stats</label><br /> <label htmlFor="hide-stats">Hide Stats</label><br />
<input type="checkbox" id="hide-stats" checked={this.hideStats} onChange={this.setHideStats}></input> <input type="checkbox" id="hide-stats" checked={this.hideStats} onChange={this.setHideStats}></input>
</div> </div>
<button className="stats-button" onClick={this.setStats}>
{this.stats == "min" && "Min Stats"}
{this.stats == "avg" && "Average Stats"}
{this.stats == "max" && "Max Stats"}
</button>
<button className="ext-button" onClick={this.setExt}>
{this.ext ? "Extended Format" : "Short Format"}
</button>
</div> </div>
<br /> <br />
<CardList <div onClick={this.handleOutOfForm}>
cards={this.content.slice(this.n * (this.p-1), this.n * this.p)} <CardList
setImage={this.setImage} cards={this.content.slice(this.n * (this.p-1), this.n * this.p)}
ext={this.ext} setImage={this.setImage}
stats={this.stats} ext={this.ext}
hideStats={this.hideStats} stats={this.stats}
/> hideStats={this.hideStats}
/>
</div>
<br /> <br />
{this.navigation()} {this.navigation()}
</div> </div>