Skip to content

Commit

Permalink
Demo using the new govuk import
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldfallen committed Oct 18, 2017
1 parent 286a9ad commit 589c9f1
Show file tree
Hide file tree
Showing 5 changed files with 680 additions and 17 deletions.
8 changes: 4 additions & 4 deletions examples/test-app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ lookAndFeel.configure(app, {
baseUrl: `http://localhost:${config.port}`,
express: { views: ['views'] },
webpack: {
entry: [
path.resolve(__dirname, './assets/scss/main.scss'),
path.resolve(__dirname, './assets/js/myJavaScript.js')
]
entry: {
main: path.resolve('./assets/scss/main.scss'),
'selection-buttons': path.resolve('./assets/js/selection-buttons.js')
}
}
});

Expand Down
5 changes: 5 additions & 0 deletions examples/test-app/assets/js/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"browser": true
}
}
7 changes: 7 additions & 0 deletions examples/test-app/assets/js/selection-buttons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import $ from 'jquery';
import ShowHideContent from 'govuk/show-hide-content';

$(document).ready(() => {
const showHideContent = new ShowHideContent();
showHideContent.init();
});
39 changes: 38 additions & 1 deletion examples/test-app/views/SelectionButtons.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{% extends "look-and-feel/layouts/two_thirds.html" %}
{% from "look-and-feel/components/header.njk" import header %}
{% from "look-and-feel/components/fields.njk" import selectionButtons %}
{% from "look-and-feel/components/fields.njk" import selectionButtons, textbox %}

{% block head -%}
<link href="{{ asset_path }}main.css" media="screen" rel="stylesheet" />
<script src="{{ asset_path }}selection-buttons.js" type="text/javascript">
</script>
{% endblock %}

{% block two_thirds -%}
Expand Down Expand Up @@ -119,5 +121,40 @@
]
) }}{% endraw %}</code></pre>
</div>


{{ header("Conditionally revealing content", size="medium") }}

<div class="example">

{% set field = { id: 'hwf', name: 'hwf' } %}
{{ selectionButtons(field, "Do have a Help with Fees reference number?",
hideQuestion = false,
inline = true,
options = [
{ label: "Yes", target: "hwf-ref-number" },
{ label: "No" }
]
) }}
<div class="panel panel-border-wide js-hidden" id="hwf-ref-number">
{{ textbox(field, "Enter your reference number") }}
</div>
</div>

<div class="panel panel-border-wide">
{{ header('Code', size='small') }}
<pre><code>{% raw %}{{ selectionButtons(field, "Do have a Help with Fees reference number?",
hideQuestion = false,
inline = true,
options = [
{ label: "Yes", target: "hwf-ref-number" },
{ label: "No" }
]
) }}
&lt;div class="panel panel-border-wide js-hidden" id="hwf-ref-number"&gt;
{{ textbox(field, "Enter your reference number") }}
&lt;/div&gt;{% endraw %}</code></pre>
</div>

{%- endblock %}

Loading

0 comments on commit 589c9f1

Please sign in to comment.