-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-fix rerender color history -fix css
- Loading branch information
Showing
6 changed files
with
177 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,53 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
|
||
const FieldSize = ({ currentSize, changeFieldSize }) => ( | ||
<div className="container"> | ||
<div className="tabs"> | ||
<input | ||
type="radio" | ||
id="radio-1" | ||
value={currentSize} | ||
onChange={() => changeFieldSize(100)} | ||
checked={currentSize === 100} | ||
/> | ||
<label className="tab" htmlFor="radio-1"> | ||
100 | ||
</label> | ||
const FieldSize = () => { | ||
const dispatch = useDispatch(); | ||
const currentSize = useSelector((state) => state.auth.fieldSize); | ||
|
||
<input | ||
type="radio" | ||
id="radio-2" | ||
value={currentSize} | ||
onChange={() => changeFieldSize(400)} | ||
checked={currentSize === 400} | ||
/> | ||
<label className="tab" htmlFor="radio-2"> | ||
400 | ||
</label> | ||
|
||
<input | ||
type="radio" | ||
id="radio-3" | ||
value={currentSize} | ||
onChange={() => changeFieldSize(1600)} | ||
checked={currentSize === 1600} | ||
/> | ||
<label className="tab" htmlFor="radio-3"> | ||
1600 | ||
</label> | ||
<span className="glider"></span> | ||
</div> | ||
</div> | ||
); | ||
|
||
const mapStateToProps = (state) => ({ | ||
currentSize: state.fieldSize, | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch) => ({ | ||
changeFieldSize: (size) => | ||
const changeFieldSize = (size) => { | ||
dispatch({ | ||
type: 'CHANGE_FIELD_SIZE', | ||
payload: { size }, | ||
}), | ||
}); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className="container"> | ||
<div className="tabs"> | ||
<input | ||
type="radio" | ||
id="radio-1" | ||
onChange={() => changeFieldSize(100)} | ||
checked={currentSize === 100} | ||
/> | ||
<label className="tab" htmlFor="radio-1"> | ||
100 | ||
</label> | ||
|
||
<input | ||
type="radio" | ||
id="radio-2" | ||
onChange={() => changeFieldSize(400)} | ||
checked={currentSize === 400} | ||
/> | ||
<label className="tab" htmlFor="radio-2"> | ||
400 | ||
</label> | ||
|
||
<input | ||
type="radio" | ||
id="radio-3" | ||
onChange={() => changeFieldSize(1600)} | ||
checked={currentSize === 1600} | ||
/> | ||
<label className="tab" htmlFor="radio-3"> | ||
1600 | ||
</label> | ||
<span className="glider"></span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(FieldSize); | ||
export default FieldSize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.