Skip to content

Commit

Permalink
Merge pull request #633 from alphagov/fix-table-captionSize-class
Browse files Browse the repository at this point in the history
Fix table captions to allow heading classes
  • Loading branch information
NickColley authored Apr 5, 2018
2 parents f3b06a0 + 3807c5e commit f016ee8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Fixes:
`a:link:focus` selector in GOV.UK Template, which was overriding focussed
links to always use the dark blue link colour for text.
(PR [#609](https://github.com/alphagov/govuk-frontend/pull/609))
- Fix table captions to allow heading classes
(PR [#633](https://github.com/alphagov/govuk-frontend/pull/633))

New features:
- Add `govuk-main-wrapper--l` a variant of the main page wrapper to use when a
Expand Down
4 changes: 2 additions & 2 deletions src/table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Find out when to use the Table component in your service in the [GOV.UK Design S

<table class="govuk-c-table">

<caption class="govuk-c-table__caption small">Caption 1 : Months and rates</caption>
<caption class="govuk-c-table__caption govuk-heading-l">Caption 1 : Months and rates</caption>

<thead class="govuk-c-table__head">
<tr class="govuk-c-table__row">
Expand Down Expand Up @@ -280,7 +280,7 @@ Find out when to use the Table component in your service in the [GOV.UK Design S

{{ govukTable({
"caption": "Caption 1 : Months and rates",
"captionSize": "small",
"captionSize": "govuk-heading-l",
"firstCellIsHeader": true,
"head": [
{
Expand Down
9 changes: 5 additions & 4 deletions src/table/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

@include govuk-exports("table") {
.govuk-c-table {
@include govuk-font-regular-19;
@include govuk-text-colour;
width: 100%;
@include govuk-responsive-margin($govuk-spacing-responsive-6, "bottom");
Expand All @@ -26,16 +27,14 @@
}

.govuk-c-table__header {
@include govuk-font-bold-19;
@include govuk-typography-weight-bold;

padding: govuk-em($govuk-spacing-scale-2, 19px) govuk-em($govuk-spacing-scale-4, 19px) govuk-em($govuk-spacing-scale-2, 19px) 0;
border-bottom: 1px solid $govuk-border-colour;
text-align: left;
}

.govuk-c-table__cell {
@include govuk-font-regular-19;

padding: govuk-em($govuk-spacing-scale-2, 19px) govuk-em($govuk-spacing-scale-4, 19px) govuk-em($govuk-spacing-scale-2, 19px) 0;
border-bottom: 1px solid $govuk-border-colour;
text-align: left;
Expand All @@ -56,7 +55,9 @@
}

.govuk-c-table__caption {
@include govuk-typography-weight-bold;

display: table-caption;
text-align: left;
@include govuk-font-bold-19;
}
}
2 changes: 1 addition & 1 deletion src/table/table.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ examples:
- name: table-with-caption-and-head
data:
caption: "Caption 1 : Months and rates"
captionSize: small
captionSize: govuk-heading-l
firstCellIsHeader: true
head:
- text: Month you apply
Expand Down
2 changes: 1 addition & 1 deletion src/table/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Table', () => {
const $ = render('table', examples['table-with-caption-and-head'])
const $caption = $('.govuk-c-table__caption')

expect($caption.hasClass('small')).toBeTruthy()
expect($caption.hasClass('govuk-heading-l')).toBeTruthy()
})

it('renders first cell in every row as a <th> element with correct `govuk-c-table__header` class and `scope=row` attribute', () => {
Expand Down

0 comments on commit f016ee8

Please sign in to comment.