forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3225 - Suggestion: Style the default browser radio button as a custom…
… one to provide a nicer UI experience (umbraco#3226)
- Loading branch information
1 parent
20c215e
commit 9230de5
Showing
3 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/Umbraco.Web.UI.Client/src/less/components/umb-radiobuttons-list.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
13 changes: 9 additions & 4 deletions
13
src/Umbraco.Web.UI.Client/src/views/propertyeditors/radiobuttons/radiobuttons.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |