Skip to content

Commit

Permalink
3225 - Suggestion: Style the default browser radio button as a custom…
Browse files Browse the repository at this point in the history
… one to provide a nicer UI experience (umbraco#3226)
  • Loading branch information
BatJan authored and nul800sebastiaan committed Oct 23, 2018
1 parent 20c215e commit 9230de5
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Umbraco.Web.UI.Client/src/less/belle.less
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
@import "components/umb-confirm-action.less";
@import "components/umb-keyboard-shortcuts-overview.less";
@import "components/umb-checkbox-list.less";
@import "components/umb-radiobuttons-list.less";
@import "components/umb-locked-field.less";
@import "components/umb-tabs.less";
@import "components/umb-load-indicator.less";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
.umb-radiobuttons{
&__label{
position: relative;
padding: 0;

&-text{
margin: 0 0 0 32px;
position: relative;
top: 1px;
}
}

&__input{
position: absolute;
top: 0;
left: 0;
opacity: 0;

&:focus ~ .umb-radiobuttons__state{
box-shadow: 0 1px 3px fade(@black, 12%), 0 1px 2px fade(@black, 24%);
}

&:focus:checked ~ .umb-radiobuttons__state{
box-shadow: none;
}

&:checked ~ .umb-radiobuttons__state{
&:before{
width: 100%;
height: 100%;
}
}

&:checked ~ .umb-radiobuttons__state .umb-radiobuttons__icon{
opacity: 1;
}
}

&__state{
display: flex;
flex-wrap: wrap;
border: 1px solid @gray-8;
border-radius: 100%;
width: 22px;
height: 22px;
position: relative;

&:before{
content: "";
background: @green;
width: 0;
height: 0;
transition: .1s ease-out;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
border-radius: 100%;
}
}

&__icon{
color: @white;
text-align: center;
font-size: 15px;
opacity: 0;
transition: .3s ease-out;

&:before{
position: absolute;
top: 2px;
right: 0;
left: 0;
bottom: 0;
margin: auto;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<div class="umb-editor umb-radiobuttons" ng-controller="Umbraco.PropertyEditors.RadioButtonsController">
<ul class="unstyled">
<li ng-repeat="item in model.config.items">
<label class="radio">
<label class="radio umb-radiobuttons__label">
<input type="radio" name="radiobuttons-{{model.alias}}"
value="{{item.id}}"
ng-model="model.value" />
{{item.value}}
ng-model="model.value"
class="umb-radiobuttons__input" />

<div class="umb-radiobuttons__state">
<i class="umb-radiobuttons__icon icon-check" aria-hidden="true"></i>
<span class="umb-radiobuttons__label-text">{{item.value}}</span>
</div>
</label>
</li>
</ul>
</div>
</div>

0 comments on commit 9230de5

Please sign in to comment.