tweak: More informative error messages
This commit is contained in:
parent
3d380e4dfa
commit
f7f77b5723
|
@ -77,11 +77,11 @@ function Track({ source, target, getTrackProps }) {
|
|||
/* Body */
|
||||
// Two functions, essentially identical.
|
||||
export function SliderElement({ onChange, value, displayFunction, domain }) {
|
||||
let toLogDomain = (arr) => [Math.log(arr[0])/Math.log(10), Math.log(arr[1])/Math.log(10)]
|
||||
let toLogDomain = (arr) => [Math.log(arr[0]) / Math.log(10), Math.log(arr[1]) / Math.log(10)]
|
||||
return (
|
||||
<Slider
|
||||
rootStyle={sliderStyle /* inline styles for the outer div. Can also use className prop. */}
|
||||
domain={toLogDomain([1/domain,domain])}
|
||||
domain={toLogDomain([1 / domain, domain])}
|
||||
values={[value]}
|
||||
step={0.0001}
|
||||
onChange={onChange}
|
||||
|
@ -125,25 +125,27 @@ export function SliderElement({ onChange, value, displayFunction, domain }) {
|
|||
)
|
||||
}
|
||||
|
||||
export function SubmitSliderButton({posList, binaryComparisons, sliderValue, toComparePair, nextStepSlider}){
|
||||
export function SubmitSliderButton({ posList, binaryComparisons, sliderValue, toComparePair, nextStepSlider }) {
|
||||
// This element didn't necessarily have to exist, but it made it easier for debugging purposes
|
||||
let onClick = (event) => {
|
||||
//event.preventDefault();
|
||||
let obj = {posList, binaryComparisons, sliderValue, element1: toComparePair[1], element2: toComparePair[0]}
|
||||
let obj = { posList, binaryComparisons, sliderValue, element1: toComparePair[1], element2: toComparePair[0] }
|
||||
//
|
||||
console.log("input@SubmitSliderButton")
|
||||
console.log(obj)
|
||||
if(sliderValue >= 0 ){
|
||||
if (!!Number(sliderValue) && sliderValue >= 0) {
|
||||
nextStepSlider(obj)
|
||||
}else if(sliderValue < 0){
|
||||
} else if (!!Number(sliderValue) && sliderValue < 0) {
|
||||
alert("Negative numbers not yet allowed")
|
||||
} else {
|
||||
alert("Your input is not a number")
|
||||
}
|
||||
}
|
||||
|
||||
return( <button
|
||||
return (<button
|
||||
className="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mt-5"
|
||||
onClick={onClick}>
|
||||
Submit
|
||||
Submit
|
||||
</button>)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user