lucid-ui
Version:
A UI component library from AppNexus.
51 lines (50 loc) • 2.08 kB
JavaScript
import React from 'react';
import createClass from 'create-react-class';
import { SwitchLabeled } from '../../../index';
const style = {
marginBottom: '3px',
};
export default createClass({
getInitialState() {
return {
airplaneMode: false,
bluetooth: false,
cellularData: false,
};
},
handleSelectedAirplaneMode(isSelected) {
this.setState({
airplaneMode: isSelected,
});
},
handleSelectedBluetooth(isSelected) {
this.setState({
bluetooth: isSelected,
});
},
handleSelectedCellularData(isSelected) {
this.setState({
cellularData: isSelected,
});
},
render() {
return (React.createElement("section", null,
React.createElement("p", null,
React.createElement("em", null,
"(Use the styles on the parent container of",
' ',
React.createElement("code", null, "SwitchLabeled"),
" components to ensure only the switches and their labels are clickable)")),
React.createElement("span", { style: {
display: 'inline-flex',
flexDirection: 'column',
alignItems: 'flex-start',
} },
React.createElement(SwitchLabeled, { isSelected: this.state.airplaneMode === true, onSelect: this.handleSelectedAirplaneMode, style: style },
React.createElement(SwitchLabeled.Label, null, "Airplane Mode")),
React.createElement(SwitchLabeled, { isSelected: this.state.bluetooth === true, onSelect: this.handleSelectedBluetooth, style: style },
React.createElement(SwitchLabeled.Label, null, "Bluetooth")),
React.createElement(SwitchLabeled, { isSelected: this.state.cellularData === true, onSelect: this.handleSelectedCellularData, style: style },
React.createElement(SwitchLabeled.Label, null, "Cellular Data")))));
},
});