Skip to content

Commit

Permalink
Use larger steps for sliders on smaller screens (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Apr 26, 2020
1 parent 8a533ad commit bd254f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/ProfileSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class ProfileSlider extends PureComponent<Props, State> {

render() {
const { strengthValue, tasteValue, valuesAdjusted } = this.state;
const stepSize =
typeof window !== 'undefined' && window.innerWidth < 768 ? 5 : 1;

const separators = stengthToSegments(strengthValue);

Expand Down Expand Up @@ -89,6 +91,7 @@ class ProfileSlider extends PureComponent<Props, State> {
<Range
min={10}
max={90}
step={stepSize}
className="w-40"
onChange={this.onChange('tasteValue')}
value={tasteValue}
Expand All @@ -106,6 +109,7 @@ class ProfileSlider extends PureComponent<Props, State> {
<Range
min={10}
max={90}
step={stepSize}
className="w-60"
onChange={this.onChange('strengthValue')}
value={strengthValue}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Range/StyledRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type StyledRangeProps = {|
value: number,
max: number | string,
min: number | string,
step: number,
onChange: (SyntheticInputEvent<HTMLInputElement>) => void,
onBlur: (SyntheticFocusEvent<HTMLInputElement>) => void,
|};
Expand Down Expand Up @@ -68,6 +69,7 @@ const StyledRange = ({
StyledRange.defaultProps = {
max: 100,
min: 0,
step: 1,
sliderIcons: ['😳'],
idleSlider: '😴',
hasChanged: false,
Expand Down

1 comment on commit bd254f3

@vercel
Copy link

@vercel vercel bot commented on bd254f3 Apr 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.