Skip to content

Commit

Permalink
Merge pull request #26 from nhsevidence/gw-32-updates
Browse files Browse the repository at this point in the history
GW-32 Minor styling updates & bug fixes
  • Loading branch information
ediblecode committed Jan 23, 2018
2 parents aaf9b6e + 8ffce61 commit 313cdd2
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 53 deletions.
21 changes: 21 additions & 0 deletions server/views/components/page-header.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends "layouts/_layout.njk" %}
{% set title = "Page header" %}
{% from "page-header/page-header.njk" import pageHeader %}

{% block body %}

<div class="container">

<h1>Page header</h1>

<h2>Default</h2>

{{ pageHeader({ heading: "Breast cancer", lead: "Everything NICE has produced on the topic of breast cancer. Includes related guidelines, NICE Pathways, quality standards and advice." }) }}

<h2>With CTA</h2>

{{ pageHeader({ heading: "Breast cancer", lead: "Everything NICE has produced on the topic of breast cancer. Includes related guidelines, NICE Pathways, quality standards and advice.", cta: { text: "Register as a stakeholder", href: "/register" } }) }}

</div>

{% endblock %}
3 changes: 3 additions & 0 deletions server/views/components/tag.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
<li>Impact {{ tag({ label: "Impact", modifier: "impact" }) }}</li>
<li>Impact alpha {{ tag({ label: "Alpha", modifiers: ["impact", "alpha"] }) }}</li>
<li>Flush {{ tag({ label: "Flush (no margin)", modifier: "flush" }) }}</li>
<li><span class="h2">Super {{ tag({ label: "Super", modifier: "super" }) }}</span></li>
</ul>

<h2>Tag on a heading {{ tag({ label: "Live", modifiers: ["live", "super"] }) }}</h2>

</div>

{% endblock %}
1 change: 1 addition & 0 deletions server/views/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<li><a href="/components/hero/">Hero</a></li>
<li><a href="/components/in-page-nav/">In page nav</a></li>
<li><a href="/components/lists/">Lists</a></li>
<li><a href="/components/page-header/">Page header</a></li>
<li><a href="/components/panels/">Panels</a></li>
<li><a href="/components/phase/">Phase banners</a></li>
<li><a href="/components/quote/">Quote</a></li>
Expand Down
11 changes: 2 additions & 9 deletions server/views/pages/topic-landing-page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% from "stacked-nav/stacked-nav.njk" import stackedNav %}
{% from "card/card.njk" import card %}
{% from "footer/footer.njk" import footer %}
{% from "page-header/page-header.njk" import pageHeader %}

{% block body %}

Expand Down Expand Up @@ -46,15 +47,7 @@
</ol>
</nav>

<h1>Breast cancer</h1>

<p class="lead">
Everything NICE has produced on the topic of breast cancer. Includes related guidelines, NICE Pathways, quality standards and advice.
</p>

<p>
<a href="https://www.nice.org.uk/get-involved/stakeholder-registration">Register as a stakeholder</a>
</p>
{{ pageHeader({ heading: "Breast cancer", lead: "Everything NICE has produced on the topic of breast cancer. Includes related guidelines, NICE Pathways, quality standards and advice.", cta: { text: "Register as a stakeholder", href: "/register" } }) }}

</div>

Expand Down
1 change: 1 addition & 0 deletions src/components/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'in-page-nav/in-page-nav',
'stacked-nav/stacked-nav',
'maintain-ratio/maintain-ratio',
'page-header/page-header',
'panel/panel',
'phase-banner/phase-banner',
'table/table',
Expand Down
2 changes: 2 additions & 0 deletions src/components/buttons/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
margin: em(0 $spacing-small $spacing-small -4px); // Negative left margin to combat inline-block gaps
padding: em($spacing-small $spacing-medium);
position: relative;
text-align: left;
text-decoration: none !important; // sass-lint:disable-line no-important
vertical-align: top;
white-space: nowrap;

&:first-child {
margin-left: 0;
Expand Down
3 changes: 1 addition & 2 deletions src/components/card/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
}

&__tag {
@include font-size(-1);
margin-right: rem($spacing-x-small);
@include font-size(-1, true);
}

&__metadata {
Expand Down
47 changes: 47 additions & 0 deletions src/components/page-header/_page-header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
////
/// @group components
////

/// Page header component.
/// Used at the top of a page to contain an h1 and optional
/// lead intro paragraph and call-to-action.
///
/// @example html
/// <header class="page-header">
/// <h1 class="page-header__heading">
/// Breast cancer
/// </h1>
/// <p class="page-header__lead">
/// Everything NICE has produced on the topic of breast cancer.
/// Includes related guidelines, NICE Pathways, quality standards and advice.
/// </p>
/// <p class="page-header__cta">
/// <a href="/some-action.html">Register as a stakeholder</a>
/// </p>
/// </header>
/// @since 0.4.0
.page-header {
margin: rem(0 0 $spacing-x-large 0);

&__heading {
@include font-size(h1);
margin: rem(0 0 $spacing-small 0);
}

&__lead {
@include font-size(lead);
margin: rem(0 0 $spacing-small 0);
}

&__cta {
@include font-size(p);
display: block;
margin: 0;
}

@media print {
&__cta {
display: none;
}
}
}
15 changes: 15 additions & 0 deletions src/components/page-header/page-header.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% macro pageHeader(pageHeader) %}
<div class="page-header">
<h1 class="page-header__heading">
{{ pageHeader.heading }}
</h1>
<p class="page-header__lead">
{{ pageHeader.lead }}
</p>
{% if pageHeader.cta %}
<p class="page-header__cta">
<a href="{{ pageHeader.cta.href }}">{{ pageHeader.cta.text }}</a>
</p>
{% endif %}
</div>
{% endmacro %}
2 changes: 1 addition & 1 deletion src/components/phase-banner/_phase-banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.phase-banner {
border-bottom: 1px solid $colour-border;
display: table;
margin: em(0 0 $spacing-medium);
margin: em(0 0 $spacing-small);
max-width: 100%;
padding: em($spacing-small 0);
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/components/stacked-nav/_stacked-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// Expands to fill the available space.
/// Usually full width on mobile and 1/3 on wider screens.
.stacked-nav {
background: #fafafa;
background: $colour-nice-white;
border: 1px solid $colour-border;
margin: em(0 0 $spacing-large);

Expand Down
9 changes: 7 additions & 2 deletions src/components/tag/_tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
/// and also used within alpha/beta phase banners.
///
/// BEM modifiers:
/// - `--impact` Larger tag, used for impact
/// - `--impact` Bolder tag, used for higher impact
/// - `--super` Super aligned, useful for tagging headings
/// - `--alpha` Alpha
/// - `--beta` Beta
/// - `--live` Live
Expand All @@ -16,6 +17,7 @@
/// - `--flush` No margin
/// @since 0.3.1
.tag {
@include font-size(0);
background-color: $colour-panel-inverse;
border-radius: em($spacing-xx-small);
color: $colour-text-inverse;
Expand All @@ -34,13 +36,16 @@
}

&--impact {
@include font-size(-1);
font-weight: 900;
letter-spacing: 1px;
padding: em($spacing-xx-small $spacing-small);
text-transform: uppercase;
}

&--super {
vertical-align: super;
}

&--alpha {
background-color: $colour-alpha;
color: $colour-text-inverse;
Expand Down
33 changes: 19 additions & 14 deletions src/stylesheets/grid/_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,55 +74,60 @@
.grid {
@include grid;

@include modifier('rev') {
&--rev {
@include grid-reverse;
}

@include modifier('gutterless') {
&--gutterless {
@include grid-gutterless;

[data-g] {
// sass-lint:disable-block no-combinators
> [data-g] {
@include grid-item-gutterless;
}
}

@include modifier('compact') {
&--compact {
@include grid-compact;

[data-g] {
// sass-lint:disable-block no-combinators
> [data-g] {
@include grid-item-compact;
}
}

@include modifier('loose') {
&--loose {
@include grid-loose;

[data-g] {
// sass-lint:disable-block no-combinators
> [data-g] {
@include grid-item-loose;
}
}

@include modifier('right') {
&--right {
@include grid-right;
}

@include modifier('center') {
&--center {
@include grid-center;
}

@include modifier('middle') {
[data-g] {
&--middle {
// sass-lint:disable-block no-combinators
> [data-g] {
@include grid-item-middle;
}
}

@include modifier('bottom') {
[data-g] {
&--bottom {
// sass-lint:disable-block no-combinators
> [data-g] {
@include grid-item-bottom;
}
}

@include modifier('debug') {
&--debug {
@include grid-debug;

[data-g] {
Expand Down
2 changes: 1 addition & 1 deletion src/stylesheets/settings/_settings-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $nice-root-font-size-min: 15;

/// The maximum root font size, used from breakpoint `$nice-root-font-size-max-breakpoint`
/// @since 0.2.13
$nice-root-font-size-max: 19;
$nice-root-font-size-max: 18;

/// The breakpoint at which the root font size starts changing from minimum
/// towards maximum.
Expand Down
19 changes: 7 additions & 12 deletions src/stylesheets/typography/_typography-headings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ h6,
.heading {
&--separator {
border-bottom: 1px solid $colour-border;
padding-bottom: rem($spacing-x-small);
}
}

Expand Down Expand Up @@ -66,37 +67,31 @@ h6,
}

h1,
.h1,
.heading--primary {
.h1 {
@include h1;
}

h2,
.h2,
.heading--secondary {
.h2 {
@include h2;
}

h3,
.h3,
.heading--tertiary {
.h3 {
@include h3;
}

h4,
.h4,
.heading--quaternary {
.h4 {
@include h4;
}

h5,
.h5,
.heading--quinary {
.h5 {
@include h5;
}

h6,
.h6,
.heading--senary {
.h6 {
@include h6;
}
Loading

0 comments on commit 313cdd2

Please sign in to comment.