-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M1466 alternative toggle #22
Conversation
|
||
const OfflineToggle = () => { | ||
const [checked, setChecked] = useState(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im thinking controlled input state can come later and will probably be in a parent component who owns offline status, or some custom hook instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I'm thinking to store in a global state with context or redux.
358a735
to
93a8b3b
Compare
/** | ||
* Describe your component | ||
*/ | ||
const ToggleCss = raw('react-toggle/style.css') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hack to get css without having it added globally. facebook/create-react-app#3722 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is cool
const OfflineToggle = () => { | ||
const [checked, setChecked] = useState(false) | ||
const ToggleWrapper = styled.div` | ||
${ToggleCss} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dump the expected third party css in a styled component wrapper and override it with library classnames.
@tienhoah Im thinking I like |
Proposing
react-toggle
instead ofreact-switch
for code maintainability (styled via css/styled components, not inline, or in return statement/jsx)