better checkbox styles
This commit is contained in:
parent
ac95dea827
commit
f17777b511
4 changed files with 97 additions and 29 deletions
|
@ -174,8 +174,9 @@ class FormField extends React.PureComponent {
|
||||||
{this.props.prefix
|
{this.props.prefix
|
||||||
? <span className="form-field__prefix">{this.props.prefix}</span>
|
? <span className="form-field__prefix">{this.props.prefix}</span>
|
||||||
: ""}
|
: ""}
|
||||||
{renderElementInsideLabel
|
{element}
|
||||||
? <label
|
{renderElementInsideLabel &&
|
||||||
|
<label
|
||||||
htmlFor={elementId}
|
htmlFor={elementId}
|
||||||
className={
|
className={
|
||||||
"form-field__label " +
|
"form-field__label " +
|
||||||
|
@ -183,10 +184,8 @@ class FormField extends React.PureComponent {
|
||||||
(isCheck ? " checked" : "")
|
(isCheck ? " checked" : "")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{element}
|
|
||||||
{this.props.label}
|
{this.props.label}
|
||||||
</label>
|
</label>}
|
||||||
: element}
|
|
||||||
{formFieldFileSelectorTypes.includes(this.props.type)
|
{formFieldFileSelectorTypes.includes(this.props.type)
|
||||||
? <FileSelector
|
? <FileSelector
|
||||||
type={this.props.type}
|
type={this.props.type}
|
||||||
|
|
|
@ -50,25 +50,22 @@ class ModalRemoveFile extends React.PureComponent {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<label>
|
|
||||||
<FormField
|
<FormField
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={deleteChecked}
|
checked={deleteChecked}
|
||||||
onClick={this.handleDeleteCheckboxClicked.bind(this)}
|
onClick={this.handleDeleteCheckboxClicked.bind(this)}
|
||||||
/>{" "}
|
label={__("Delete this file from my computer")}
|
||||||
{__("Delete this file from my computer")}
|
/>
|
||||||
</label>
|
|
||||||
</section>
|
</section>
|
||||||
|
<br />
|
||||||
{claimIsMine &&
|
{claimIsMine &&
|
||||||
<section>
|
<section>
|
||||||
<label>
|
|
||||||
<FormField
|
<FormField
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={abandonClaimChecked}
|
checked={abandonClaimChecked}
|
||||||
onClick={this.handleAbandonClaimCheckboxClicked.bind(this)}
|
onClick={this.handleAbandonClaimCheckboxClicked.bind(this)}
|
||||||
/>{" "}
|
label={__("Abandon the claim for this URI")}
|
||||||
{__("Abandon the claim for this URI")}
|
/>
|
||||||
</label>
|
|
||||||
</section>}
|
</section>}
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,4 +25,5 @@
|
||||||
@import "component/_tabs.scss";
|
@import "component/_tabs.scss";
|
||||||
@import "component/_media.scss";
|
@import "component/_media.scss";
|
||||||
@import "component/_divider.scss";
|
@import "component/_divider.scss";
|
||||||
|
@import "component/_checkbox.scss";
|
||||||
@import "page/_show.scss";
|
@import "page/_show.scss";
|
||||||
|
|
71
ui/scss/component/_checkbox.scss
Normal file
71
ui/scss/component/_checkbox.scss
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
*, *:before, *:after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
$md-checkbox-checked-color: var(--color-primary);
|
||||||
|
$md-checkbox-border-color: rgba(0, 0, 0, 0.54);
|
||||||
|
|
||||||
|
$md-checkbox-size: 20px;
|
||||||
|
$md-checkbox-padding: 4px;
|
||||||
|
|
||||||
|
$md-checkmark-width: 2px;
|
||||||
|
$md-checkmark-color: #fff;
|
||||||
|
|
||||||
|
.form-field--checkbox {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
label {
|
||||||
|
cursor: pointer;
|
||||||
|
&:before, &:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left:0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
// box
|
||||||
|
width: $md-checkbox-size;
|
||||||
|
height: $md-checkbox-size;
|
||||||
|
background: transparent;
|
||||||
|
border: 2px solid $md-checkbox-border-color;
|
||||||
|
border-radius: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background .3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
// checkmark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"] {
|
||||||
|
outline: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
margin-right: 16px;
|
||||||
|
|
||||||
|
&:checked {
|
||||||
|
|
||||||
|
+ label:before{
|
||||||
|
background: $md-checkbox-checked-color;
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
+ label:after {
|
||||||
|
|
||||||
|
$md-checkmark-size: $md-checkbox-size - 2*$md-checkbox-padding;
|
||||||
|
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
|
||||||
|
top: ($md-checkbox-size / 2) - ($md-checkmark-size / 4) - $md-checkbox-size/10;
|
||||||
|
left: $md-checkbox-padding;
|
||||||
|
width: $md-checkmark-size;
|
||||||
|
height: $md-checkmark-size / 2;
|
||||||
|
|
||||||
|
border: $md-checkmark-width solid $md-checkmark-color;
|
||||||
|
border-top-style: none;
|
||||||
|
border-right-style: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue