Skip to content

Commit

Permalink
New design for checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Bijl committed Feb 20, 2017
1 parent 8c23a88 commit 4781f28
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 97 deletions.
13 changes: 7 additions & 6 deletions examples/checkbox/checkbox-1/checkbox-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<script src="../../js/highlight.pack.js"></script>
<script src="../../js/app.js"></script>

<link href="css/checkbox.css" rel="stylesheet">

<link href="../css/checkbox.css" rel="stylesheet">
<script src="js/checkbox.js" type="text/javascript"></script>
</head>
<body>
Expand All @@ -34,10 +33,12 @@ <h2 id="ex_label">Example</h2>
<div id="ex1">
<h3>Sandwich Condiments</h3>
<div>
<div role="checkbox" aria-checked="false" tabindex= "0">Lettuce</div>
<div role="checkbox" aria-checked="true" tabindex= "0">Tomato</div>
<div role="checkbox" aria-checked="false" tabindex= "0">Mustard</div>
<div role="checkbox" aria-checked="false" tabindex= "0">Sprouts</div>
<ul>
<li><div role="checkbox" aria-checked="false" tabindex= "0">Lettuce</div></li>
<li><div role="checkbox" aria-checked="true" tabindex= "0">Tomato</div></li>
<li><div role="checkbox" aria-checked="false" tabindex= "0">Mustard</div></li>
<li><div role="checkbox" aria-checked="false" tabindex= "0">Sprouts</div></li>
</ul>
</div>

<script type="text/javascript">
Expand Down
31 changes: 0 additions & 31 deletions examples/checkbox/checkbox-1/css/checkbox.css

This file was deleted.

Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions examples/checkbox/checkbox-2/checkbox-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<script src="../../js/highlight.pack.js"></script>
<script src="../../js/app.js"></script>

<link href="css/checkboxMixed.css" rel="stylesheet">

<link href="../css/checkbox.css" rel="stylesheet">
<script src="js/controlledCheckbox.js" type="text/javascript"></script>
<script src="js/checkboxMixed.js" type="text/javascript"></script>
</head>
Expand Down
58 changes: 0 additions & 58 deletions examples/checkbox/checkbox-2/css/checkboxMixed.css

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
69 changes: 69 additions & 0 deletions examples/checkbox/css/checkbox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[role="checkbox"] {
display: inline-block;
position: relative;
padding-left: 1.4em;
cursor: default;
}

[role="checkbox"]::before,
[role="checkbox"]::after {
position: absolute;
top: 50%;
left: 7px;
transform: translate(-50%, -50%);
content: '';
}

[role="checkbox"]::before {
width: 14px;
height: 14px;
border: 1px solid hsl(0, 0%, 66%);
border-radius: .2em;
background-image: linear-gradient(to bottom, hsl(300, 3%, 93%), #fff 30%);
}

[role="checkbox"]:active::before {
background-image: linear-gradient(to bottom, hsl(300, 3%, 73%), hsl(300, 3%, 93%) 30%);
}

[role="checkbox"][aria-checked="mixed"]::before,
[role="checkbox"][aria-checked="true"]::before {
border-color: hsl(216, 80%, 50%);
background: hsl(217, 95%, 68%);
background-image: linear-gradient(to bottom, hsl(217, 95%, 68%), hsl(216, 80%, 57%));
}

[role="checkbox"][aria-checked="mixed"]::after {
display: block;
width: 6px;
border-bottom: 0.125em solid #fff;
}

[role="checkbox"][aria-checked="mixed"]:active::after,
[role="checkbox"][aria-checked="true"]::after {
display: block;
width: .25em;
height: .4em;
border: solid #fff;
border-width: 0 .125em .125em 0;
transform: translateY(-65%) translateX(-50%) rotate(45deg);
}

[role="checkbox"][aria-checked="mixed"]:active::before,
[role="checkbox"][aria-checked="true"]:active::before {
background-image: linear-gradient(to bottom, hsl(216, 80%, 57%), hsl(217, 95%, 68%));
}

[role="checkbox"]:focus {
outline: none;
}

[role="checkbox"]:focus::before {
width: 16px;
height: 16px;
box-sizing: content-box;
border-color: hsl(216, 94%, 73%);
border-width: 3px;
border-radius: calc(.2em + 3px);
box-shadow: inset 0 0 0 1px hsl(216, 80%, 50%);
}

0 comments on commit 4781f28

Please sign in to comment.