智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LightingSystemApp-serial/.svn/pristine/84/849d32cda2e6082b8495c340c1a...

51 lines
1.4 KiB

3 years ago
const React = require('react');
function ToggleOption({ children, filter, activeFilters, setFilters }) {
return (
<button
className={
'toggle__option ' + (activeFilters[filter] ? 'is-toggled' : '')
}
onClick={() =>
setFilters({
...activeFilters,
[filter]: !activeFilters[filter]
})
}
>
{children}
</button>
);
}
module.exports = function FilterToggle({ activeFilters, setFilters }) {
return (
<div className="toggle">
<div className="toggle__label">Filter:</div>
<div className="toggle__options">
<ToggleOption
filter="low"
activeFilters={activeFilters}
setFilters={setFilters}
>
Low
</ToggleOption>
<ToggleOption
filter="medium"
activeFilters={activeFilters}
setFilters={setFilters}
>
Medium
</ToggleOption>
<ToggleOption
filter="high"
activeFilters={activeFilters}
setFilters={setFilters}
>
High
</ToggleOption>
</div>
</div>
);
};