From e8c78539ae471279efaae7149be69d17496126a2 Mon Sep 17 00:00:00 2001 From: Jonny Date: Wed, 12 Jun 2019 11:39:51 +0200 Subject: [PATCH] Make consistent style with the second number selection --- pages/create.js | 53 +++++++++++++++++++++------------- static/css/create.css | 4 +++ static/icons/chevron-left.svg | 3 -- static/icons/chevron-right.svg | 3 -- 4 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 static/css/create.css delete mode 100644 static/icons/chevron-left.svg delete mode 100644 static/icons/chevron-right.svg diff --git a/pages/create.js b/pages/create.js index 1ef0fd3..9eca46d 100644 --- a/pages/create.js +++ b/pages/create.js @@ -11,6 +11,7 @@ import EditableStringList from '../js/components/EditableStringList'; import {createTournament} from '../js/api'; import '../static/css/everypage.css'; +import '../static/css/create.css'; import RequireLogin from '../js/components/RequireLogin'; class CreatePage extends React.Component { @@ -73,9 +74,10 @@ class CreateTournamentForm extends React.Component { this.handleNameInput = this.handleNameInput.bind(this); this.handleDescriptionInput = this.handleDescriptionInput.bind(this); this.handlePublicInput = this.handlePublicInput.bind(this); - this.handleGroupSizeInput = this.handleGroupSizeInput.bind(this); this.increaseGroupAdvance = this.increaseGroupAdvance.bind(this); this.decreaseGroupAdvance = this.decreaseGroupAdvance.bind(this); + this.increaseGroupSize = this.increaseGroupSize.bind(this); + this.decreaseGroupSize = this.decreaseGroupSize.bind(this); this.generateTournamentCreationObject = this.generateTournamentCreationObject.bind(this); this.create = this.create.bind(this); @@ -107,24 +109,32 @@ class CreateTournamentForm extends React.Component { className="groupphasefader"> - + + + + + + + + + - + - + @@ -175,19 +185,22 @@ class CreateTournamentForm extends React.Component { } } - handleGroupSizeInput(input) { - const newSize = input.target.value; + increaseGroupSize() { + this.setState({groupSize: this.state.groupSize+1}); + } - if (newSize === undefined || newSize < 2) { - return; - } + decreaseGroupSize() { + const newGroupSize = this.state.groupSize - 1; - if (newSize < this.state.groupAdvance) { - this.setState({ - groupSize: newSize, groupAdvance: Math.floor(this.state.groupAdvance / 2) - }); - } else { - this.setState({groupSize: newSize}); + if (newGroupSize >= 3) { + if (newGroupSize >= this.state.groupAdvance) { + this.setState({groupSize: newGroupSize}); + } else { + this.setState({ + groupSize: newGroupSize, + groupAdvance: Math.floor(this.state.groupAdvance / 2) + }); + } } } diff --git a/static/css/create.css b/static/css/create.css new file mode 100644 index 0000000..0577cc2 --- /dev/null +++ b/static/css/create.css @@ -0,0 +1,4 @@ + +.btn-width { + width: 48px; +} \ No newline at end of file diff --git a/static/icons/chevron-left.svg b/static/icons/chevron-left.svg deleted file mode 100644 index 256902c..0000000 --- a/static/icons/chevron-left.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/static/icons/chevron-right.svg b/static/icons/chevron-right.svg deleted file mode 100644 index 2da0760..0000000 --- a/static/icons/chevron-right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file