Custom checkbox
This commit is contained in:
@@ -36,10 +36,15 @@ export default connect(null, mapDispatchToProps)(props => {
|
|||||||
let data;
|
let data;
|
||||||
switch (props.template.type) {
|
switch (props.template.type) {
|
||||||
case "bool":
|
case "bool":
|
||||||
data = <input checked={JSON.parse(props.value)}
|
data = (
|
||||||
disabled={props.readOnly}
|
<label className='CheckBoxOwner'>
|
||||||
onChange={e=>handleChanged(e)}
|
<input checked={JSON.parse(props.value)}
|
||||||
type={'checkbox'}/>;
|
disabled={props.readOnly}
|
||||||
|
onChange={e=>handleChanged(e)}
|
||||||
|
type='checkbox'/>
|
||||||
|
<span className='CheckMark'/>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "double":
|
case "double":
|
||||||
|
|||||||
@@ -125,9 +125,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
colSpan={28}
|
colSpan={28}
|
||||||
row={secondRow}
|
row={secondRow}
|
||||||
rowSpan={7}>
|
rowSpan={7}>
|
||||||
<input checked={props.PState.AutoMount}
|
<label className='CheckBoxOwner'>Auto-mount
|
||||||
onChange={handleAutoMountChanged}
|
<input checked={props.PState.AutoMount}
|
||||||
type='checkbox'/>Auto-mount
|
id={'checkbox_am_' + props.provider}
|
||||||
|
onChange={handleAutoMountChanged}
|
||||||
|
type='checkbox'/>
|
||||||
|
<span className='CheckMark'/>
|
||||||
|
</label>
|
||||||
</RootElem>
|
</RootElem>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -136,9 +140,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
colSpan={24}
|
colSpan={24}
|
||||||
row={secondRow}
|
row={secondRow}
|
||||||
rowSpan={7}>
|
rowSpan={7}>
|
||||||
<input checked={props.PState.AutoRestart}
|
<label className='CheckBoxOwner'>Restart
|
||||||
onChange={handleAutoRestartChanged}
|
<input checked={props.PState.AutoRestart}
|
||||||
type='checkbox'/>Restart
|
id={'checkbox_ar_' + props.provider}
|
||||||
|
onChange={handleAutoRestartChanged}
|
||||||
|
type='checkbox'/>
|
||||||
|
<span className='CheckMark'/>
|
||||||
|
</label>
|
||||||
</RootElem>
|
</RootElem>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
68
src/css/checkbox.css
Normal file
68
src/css/checkbox.css
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/* Customize the label (the container) */
|
||||||
|
label.CheckBoxOwner {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the browser's default checkbox */
|
||||||
|
label.CheckBoxOwner input[type=checkbox] {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 0;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a custom checkbox */
|
||||||
|
.CheckMark {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: var(--border_radius);
|
||||||
|
background-color: var(--control_background);
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* On mouse-over, add a grey background color */
|
||||||
|
label.CheckBoxOwner:hover input[type=checkbox] ~ .CheckMark {
|
||||||
|
background-color: var(--control_background_hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* When the checkbox is checked, add a blue background */
|
||||||
|
label.CheckBoxOwner input:checked ~ .CheckMark {
|
||||||
|
background-color: var(--control_background);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the CheckMark/indicator (hidden when not checked) */
|
||||||
|
.CheckMark:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show the CheckMark when checked */
|
||||||
|
label.CheckBoxOwner input:checked ~ .CheckMark:after {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Style the CheckMark/indicator */
|
||||||
|
label.CheckBoxOwner .CheckMark:after {
|
||||||
|
left: 6px;
|
||||||
|
top: 1px;
|
||||||
|
width: 5px;
|
||||||
|
height: 10px;
|
||||||
|
border: solid var(--heading_text_color);
|
||||||
|
border-width: 0 3px 3px 0;
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-ms-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
--border_radius: 4px;
|
--border_radius: 4px;
|
||||||
|
|
||||||
--control_background: rgba(105, 105, 150, 0.2);
|
--control_background: rgba(105, 105, 150, 0.2);
|
||||||
--control_background_hover: rgba(105, 105, 150, 0.3);
|
--control_background_hover: rgba(105, 105, 150, 0.4);
|
||||||
--control_border: 1px solid rgba(80, 80, 90, 0.9);
|
--control_border: 1px solid rgba(80, 80, 90, 0.9);
|
||||||
--control_box_shadow: 2px 2px 2px black;
|
--control_box_shadow: 2px 2px 2px black;
|
||||||
--control_transparent_background: rgba(10, 10, 16, 0.5);
|
--control_transparent_background: rgba(10, 10, 16, 0.5);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
import './css/checkbox.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import createAppStore from './redux/store/createAppStore';
|
import createAppStore from './redux/store/createAppStore';
|
||||||
import {getIPCRenderer} from './utils';
|
import {getIPCRenderer} from './utils';
|
||||||
|
|||||||
Reference in New Issue
Block a user