Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add desktop specific grid classes #1094

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

([PR #N](https://github.com/alphagov/govuk-frontend/pull/N))

- Add desktop specific grid column widths

This allow you to define different grid behaviour for the tablet and desktop
breakpoints. For example, you can make a column two-thirds on desktop but
expand to full-width on smaller tablet sized screens.

([PR #1094](https://github.com/alphagov/govuk-frontend/pull/1094))

- Add summary list component

This component was initially developed to allow us to build the
Expand Down
31 changes: 31 additions & 0 deletions app/views/examples/grid/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,35 @@
</p>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half govuk-grid-column-three-quarters-from-desktop">
<h2 class="govuk-heading-m">One half (three quarters from desktop)</h2>
<p class="govuk-body">
This guide shows how to make your service look consistent with the rest of GOV.UK. It includes example code and guidance for layout, typography, colour, images, icons, forms, buttons and data.
</p>
</div>

<div class="govuk-grid-column-one-half govuk-grid-column-one-quarter-from-desktop">
<h2 class="govuk-heading-m">One half (one quarter from desktop)</h2>
<p class="govuk-body">
This guide shows how to make your service look consistent with the rest of GOV.UK. It includes example code and guidance for layout, typography, colour, images, icons, forms, buttons and data.
</p>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters govuk-grid-column-two-thirds-from-desktop">
<h2 class="govuk-heading-m">Three quarters (two thirds from desktop)</h2>
<p class="govuk-body">
This guide shows how to make your service look consistent with the rest of GOV.UK. It includes example code and guidance for layout, typography, colour, images, icons, forms, buttons and data.
</p>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<h2 class="govuk-heading-m">Two thirds from desktop</h2>
<p class="govuk-body">
This guide shows how to make your service look consistent with the rest of GOV.UK. It includes example code and guidance for layout, typography, colour, images, icons, forms, buttons and data.
</p>
</div>
</div>
{% endblock %}
9 changes: 9 additions & 0 deletions src/objects/_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@
@include govuk-grid-column($width, $class: false)
}
}

// These *must* be defined in a separate loop as they have the same
// specificity as the non-breakpoint specific classes, so need to appear after
// them in the outputted CSS
@each $width in map-keys($govuk-grid-widths) {
.govuk-grid-column-#{$width}-from-desktop {
@include govuk-grid-column($width, $at: desktop, $class: false)
}
}
}