Skip to content

Commit

Permalink
address diego review - remove unnecessary checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Sep 8, 2023
1 parent f8374c1 commit 6f0f84b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 22 deletions.
8 changes: 0 additions & 8 deletions docs/data/material/components/slider/MinimumDistanceSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ export default function MinimumDistanceSlider() {
const [value1, setValue1] = React.useState([20, 37]);

const handleChange1 = (event, newValue, activeThumb) => {
if (!Array.isArray(newValue)) {
return;
}

if (activeThumb === 0) {
setValue1([Math.min(newValue[0], value1[1] - minDistance), value1[1]]);
} else {
Expand All @@ -26,10 +22,6 @@ export default function MinimumDistanceSlider() {
const [value2, setValue2] = React.useState([20, 37]);

const handleChange2 = (event, newValue, activeThumb) => {
if (!Array.isArray(newValue)) {
return;
}

if (newValue[1] - newValue[0] < minDistance) {
if (activeThumb === 0) {
const clamped = Math.min(newValue[0], 100 - minDistance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ export default function MinimumDistanceSlider() {
const [value1, setValue1] = React.useState<number[]>([20, 37]);

const handleChange1 = (event: Event, newValue: number[], activeThumb: number) => {
if (!Array.isArray(newValue)) {
return;
}

if (activeThumb === 0) {
setValue1([Math.min(newValue[0], value1[1] - minDistance), value1[1]]);
} else {
Expand All @@ -26,10 +22,6 @@ export default function MinimumDistanceSlider() {
const [value2, setValue2] = React.useState<number[]>([20, 37]);

const handleChange2 = (event: Event, newValue: number[], activeThumb: number) => {
if (!Array.isArray(newValue)) {
return;
}

if (newValue[1] - newValue[0] < minDistance) {
if (activeThumb === 0) {
const clamped = Math.min(newValue[0], 100 - minDistance);
Expand Down
4 changes: 1 addition & 3 deletions docs/data/material/components/slider/NonLinearSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default function NonLinearSlider() {
const [value, setValue] = React.useState(10);

const handleChange = (event, newValue) => {
if (typeof newValue === 'number') {
setValue(newValue);
}
setValue(newValue);
};

return (
Expand Down
4 changes: 1 addition & 3 deletions docs/data/material/components/slider/NonLinearSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default function NonLinearSlider() {
const [value, setValue] = React.useState(10);

const handleChange = (event: Event, newValue: number) => {
if (typeof newValue === 'number') {
setValue(newValue);
}
setValue(newValue);
};

return (
Expand Down

0 comments on commit 6f0f84b

Please sign in to comment.