Skip to content

Commit bda29c4

Browse files
author
Cathy Siller
committed
feature(choice-tiles): added choice tiles component per design spec
1 parent f087641 commit bda29c4

File tree

24 files changed

+1043
-4
lines changed

24 files changed

+1043
-4
lines changed

docs/_data/nav.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{ label: 'Busy', path: 'busy' },
2525
{ label: 'Buttons', path: 'buttons' },
2626
{ label: 'Checkboxes', path: 'checkboxes' },
27+
{ label: 'Choice Tiles', path: 'choice-tiles' },
2728
//{ label: 'Colors', path: 'colors' },
2829
{ label: 'Grid', path: 'grid' },
2930
{ label: 'Icons', path: 'icons' },
@@ -83,6 +84,9 @@
8384
{ label: '<hx-tablist>', path: 'hx-tablist' },
8485
{ label: '<hx-tabpanel>', path: 'hx-tabpanel' },
8586
{ label: '<hx-tabset>', path: 'hx-tabset' },
87+
{ label: '<hx-tile>', path: 'hx-tile' },
88+
{ label: '<hx-tile-description>', path: 'hx-tile-description' },
89+
{ label: '<hx-tile-title>', path: 'hx-tile-title' },
8690
{ label: '<hx-tooltip>', path: 'hx-tooltip' },
8791
],
8892
},

docs/_templates/test.njk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends 'application.njk' %}
2+
3+
{% block layout %}
4+
<main id="content" class="hxBox-md">
5+
<h1>{{ page.title }}</h1>
6+
7+
{% block content %}
8+
{# freeform page content goes here #}
9+
{% endblock %}
10+
</main>
11+
{% endblock %}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import Util from '../../_util';
2+
3+
if (document.getElementById('vue-choiceDemo')) {
4+
new Vue({
5+
el: '#vue-choiceDemo',
6+
data: {
7+
size: {
8+
label: 'Default',
9+
value: '',
10+
},
11+
sizes: [
12+
{ value: 'hxSm', label: 'Small' },
13+
{ value: '', label: 'Default' },
14+
{ value: 'hxLg', label: 'Large' },
15+
],
16+
description: 'A couple of descriptive lines or a small bit of help text.',
17+
isChecked: false,
18+
isDisabled: false,
19+
isInvalid: false,
20+
isSubdued: false,
21+
},
22+
methods: {
23+
onClick: function (evt) {
24+
this.isChecked = evt.target.checked;
25+
},
26+
},
27+
computed: {
28+
tileClasses: function () {
29+
let out = [];
30+
out.push(this.size.value);
31+
if (this.isSubdued) {
32+
out.push('hxSubdued');
33+
}
34+
return out.join(' ').trim();
35+
},
36+
hasClasses: function () {
37+
return (this.tileClasses !== '');
38+
},
39+
snippet: function () {
40+
return Util.snippet(`
41+
<label class="hxChoice">
42+
<input type="radio"
43+
${this.isChecked ? 'checked' : ''}
44+
${this.isDisabled ? 'disabled' : ''}
45+
${this.isInvalid ? 'invalid' : ''}>
46+
<hx-tile ${this.hasClasses ? `class="${this.tileClasses}"` : ''}>
47+
<hx-icon type="checkmark"></hx-icon>
48+
<div class="hx-tile-icon">
49+
<hx-icon type="account"></hx-icon>
50+
</div>
51+
<hx-tile-title>
52+
Title here
53+
</hx-tile-title>
54+
<hx-tile-description>
55+
${this.description}
56+
</hx-tile-description>
57+
</hx-tile>
58+
</label>
59+
`);
60+
},
61+
},
62+
});
63+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Choice Tiles
3+
also:
4+
elements/hx-tile: <hx-tile>
5+
elements/hx-tile-title: <hx-tile-title>
6+
elements/hx-tile-description: <hx-tile-description>
7+
---
8+
{% extends 'component.njk' %}
9+
{% block content %}
10+
11+
<section>
12+
<h2 id="demos">Demos</h2>
13+
<div id="vue-choiceDemo" class="hxRow" v-cloak>
14+
<div class="hxCol hxSpan-12-xs hxSpan-3-lg hxOrder-2-lg">
15+
<h3>Options</h3>
16+
<p>
17+
<b>Size:</b><br />
18+
<select v-model="size">
19+
<option v-for="_size in sizes" :value="_size">
20+
{% raw %}{{ _size.label }}{% endraw %}
21+
</option>
22+
</select>
23+
</p>
24+
<p>
25+
<b>Description:</b><br />
26+
<textarea class="hxTextCtrl" v-model="description"></textarea>
27+
</p>
28+
<p>
29+
<label>
30+
<input type="checkbox" v-model="isChecked" />
31+
Checked
32+
</label><br />
33+
<label>
34+
<input type="checkbox" v-model="isDisabled" />
35+
Disabled
36+
</label><br />
37+
<label>
38+
<input type="checkbox" v-model="isInvalid" />
39+
Invalid
40+
</label><br />
41+
<label>
42+
<input type="checkbox" v-model="isSubdued" />
43+
Subdued
44+
</label>
45+
</p>
46+
</div>
47+
<div class="hxCol hxSpan-12-xs hxSpan-9-lg hxOrder-1-lg">
48+
<h3>Basic Choice Tile</h3>
49+
<div class="demo choice-tile-demo">
50+
<label class="hxChoice">
51+
<input type="radio" name="foo"
52+
@click="onClick"
53+
:checked="isChecked"
54+
:disabled="isDisabled"
55+
:invalid="isInvalid" />
56+
<hx-tile :class="tileClasses">
57+
<hx-icon type="checkmark"></hx-icon>
58+
<div class="hx-tile-icon">
59+
<hx-icon type="account"></hx-icon>
60+
</div>
61+
<hx-tile-title>Title Here</hx-tile-title>
62+
<hx-tile-description v-text="description"></hx-tile-description>
63+
</hx-tile>
64+
</label>
65+
</div>
66+
<pre><code>{% raw %}{{snippet}}{% endraw %}</code></pre>
67+
</div>
68+
</div>
69+
</section>
70+
{% endblock %}

0 commit comments

Comments
 (0)