-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15bab91
commit aefe039
Showing
5 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Checkbox-Group arguments: | ||
{array} options each has name and value (strings) | ||
*/ | ||
|
||
var dom = require('../services/dom'); | ||
|
||
function createOptions(name, options) { | ||
return options.map(function (option) { | ||
var optName = option.name, | ||
optValue = option.value, | ||
id = name + '-' + optValue + '-' + optName; | ||
|
||
return ` | ||
<div class="checkbox-group-item"> | ||
<input name="${name}" rv-field="${name}" type="checkbox" id="${id}" rv-checked="${name}.data.${optValue}" value="${optValue}" /> | ||
<label for="${id}">${optName}</label> | ||
</div> | ||
`; | ||
}).join('\n'); | ||
} | ||
|
||
module.exports = function (result, args) { | ||
var name = result.name, | ||
options = args.options, | ||
field; | ||
|
||
field = dom.create(` | ||
<div class="input-label"> | ||
<div class="checkbox-group"> | ||
${ createOptions(name, options) } | ||
</div> | ||
</div> | ||
`); | ||
|
||
result.el = field; | ||
|
||
return result; | ||
}; |
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,17 @@ | ||
@import '../styleguide/inputs'; | ||
@import '../styleguide/typography'; | ||
|
||
.checkbox-group .checkbox-group-item { | ||
margin: 0; | ||
padding: 0; | ||
width: 100%; | ||
} | ||
|
||
.checkbox-group input { | ||
@include checkbox(); | ||
} | ||
|
||
.checkbox-group label { | ||
@include normal-text(); | ||
@include overlay-copy(); | ||
} |
Empty file.
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
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