Skip to content

Commit

Permalink
Support previews for full width components (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd authored Dec 19, 2023
1 parent 2e27f19 commit b4ddade
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
10 changes: 8 additions & 2 deletions docs/_components/example/_example.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
border: 0;
border-right: 1px solid $govuk-border-colour;
display: block;
max-width: 100%;
padding: govuk-spacing(4);
max-width: calc(100% - govuk-spacing(4) * 2);
resize: both;
width: 100%;
}

Expand All @@ -14,8 +16,12 @@
.app-example__tabs {
// stylelint-disable selector-max-id
.govuk-tabs__panel#preview {
background: govuk-colour("light-grey");
padding: 0;
padding-right: 1px;
}

.x-govuk-code {
margin: 0;
}
}

Expand Down
25 changes: 25 additions & 0 deletions docs/_layouts/example-full-width.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "layouts/base.njk" %}
{% from "x-govuk/components/autocomplete/macro.njk" import xGovukAutocomplete %}

{% block head %}
{{ super() }}
<style>
.govuk-template { background-color: transparent; }
</style>
{% endblock %}

{% block header %}{% endblock %}

{% block main %}
{{ content }}
{% endblock %}

{% block scripts %}
<script src="{{ '/assets/iframeResizer.contentWindow.js' | url }}"></script>
<script src="{{ '/assets/x-govuk/all.js' | url }}"></script>
<script>
window.GOVUKPrototypeComponents.initAll()
</script>
{% endblock %}

{% block footer %}{% endblock %}
9 changes: 9 additions & 0 deletions docs/_layouts/example.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{% extends "layouts/base.njk" %}
{% from "x-govuk/components/autocomplete/macro.njk" import xGovukAutocomplete %}

{% set mainClasses = "govuk-!-padding-bottom-1" %}

{% block head %}
{{ super() }}
<style>
.govuk-template { background-color: transparent; }
</style>
{% endblock %}

{% block header %}{% endblock %}

{% block content %}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/masthead.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
eleventyExcludeFromCollections: true
layout: example.njk
layout: example-full-width.njk
title: Masthead example
---
{% from "x-govuk/components/masthead/macro.njk" import xGovukMasthead %}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/primary-navigation.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
eleventyExcludeFromCollections: true
layout: example.njk
layout: example-full-width.njk
title: Primary navigation
---
{% from "x-govuk/components/primary-navigation/macro.njk" import xGovukPrimaryNavigation %}
Expand Down

0 comments on commit b4ddade

Please sign in to comment.