Skip to content

Commit

Permalink
Use govukTable for options tables
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Dec 23, 2023
1 parent 24c0803 commit e666e62
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 93 deletions.
13 changes: 13 additions & 0 deletions docs/assets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@media screen and (min-width: 800px) {
.app-prose-scope .govuk-table {
display: table;
}

.app-prose-scope .govuk-table__header:first-of-type {
width: 30%;
}

.app-prose-scope .govuk-table__cell *:last-child {
margin-bottom: 0;
}
}
25 changes: 21 additions & 4 deletions docs/layouts/collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@ Page content

In addition to [common front matter options](/layouts#common-front-matter-options), this layout accepts the following options:

| Name | Type | Description |
| :-------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **pagination** | object | **Required.** Pages to show in the paginated list. Learn more about [pagination](https://www.11ty.dev/docs/pagination/) in the documentation for Eleventy. |
| **paginationHeading** | string | Heading for the list of paginated pages. |
{% from "govuk/components/table/macro.njk" import govukTable %}
{{ govukTable({
firstCellIsHeader: true,
head: [
{ text: "Name" },
{ text: "Type" },
{ text: "Description" }
],
rows: [
[
{ text: "pagination" },
{ text: "object" },
{ text: "**Required.** Pages to show in the paginated list. Learn more about [pagination](https://www.11ty.dev/docs/pagination/) in the documentation for Eleventy." | markdown }
],
[
{ text: "paginationHeading" },
{ text: "string" },
{ text: "Heading for the list of paginated pages." }
]
]
}) }}
97 changes: 81 additions & 16 deletions docs/layouts/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,84 @@ Page content

In addition to [common front matter options](/layouts#common-front-matter-options), this layout accepts the following options:

| Name | Type | Description |
| :----------------------- | :------------------------- | :------------------------------------------------------------------------------------------- |
| **author** | string or object | Post author. |
| **author.name** | string | Name of post author. Overrides any single value given for author. |
| **author.url** | string | URL for website of post author. |
| **authors** | array | Post authors. Overrides any value(s) given for author. |
| **authors.name** | string | Name of post author. |
| **authors.url** | string | URL for website of post author. |
| **date** | string | Date post was published using the [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). |
| **image** | object | Image shown above post content. |
| **image.src** | string | Path to post image. |
| **image.alt** | string | Alternative text for post image. |
| **image.caption** | string | Caption shown below post image. |
| **image.opengraphImage** | boolean | Whether image should also be used as the page’s Open Graph share image. |
| **modified** | string | Date post was updated using the [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). |
| **tags** | Array | List of tags post relates to |
{% from "govuk/components/table/macro.njk" import govukTable %}
{{ govukTable({
firstCellIsHeader: true,
head: [
{ text: "Name" },
{ text: "Type" },
{ text: "Description" }
],
rows: [
[
{ text: "author" },
{ text: "string or object" },
{ text: "Post author." }
],
[
{ text: "author.name" },
{ text: "string" },
{ text: "Name of post author. Overrides any single value given for author." }
],
[
{ text: "author.url" },
{ text: "string" },
{ text: "URL for website of post author." }
],
[
{ text: "authors" },
{ text: "Array" },
{ text: "Post authors. Overrides any value(s) given for author." }
],
[
{ text: "authors.name" },
{ text: "string" },
{ text: "Name of post author." }
],
[
{ text: "authors.url" },
{ text: "string" },
{ text: "URL for website of post author." }
],
[
{ text: "date" },
{ text: "string" },
{ text: "Date post was published using the [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601)." | markdown }
],
[
{ text: "image" },
{ text: "object" },
{ text: "Image shown above post content." }
],
[
{ text: "image.src" },
{ text: "string" },
{ text: "Path to post image." }
],
[
{ text: "image.alt" },
{ text: "string" },
{ text: "Alternative text for post image." }
],
[
{ text: "image.caption" },
{ text: "string" },
{ text: "Caption shown below post image." }
],
[
{ text: "image.opengraphImage" },
{ text: "boolean" },
{ text: "Whether image should also be used as the page’s Open Graph share image." }
],
[
{ text: "modified" },
{ text: "string" },
{ text: "Date post was updated using the [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601)." | markdown }
],
[
{ text: "tags" },
{ text: "Array" },
{ text: "List of tags post relates to." }
]
]
}) }}
49 changes: 41 additions & 8 deletions docs/layouts/product.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,44 @@ Page content

In addition to [common front matter options](/layouts#common-front-matter-options), this layout also accepts the following options:

| Name | Type | Description |
| :------------------- | :----- | :------------------------------------------------------------------------------ |
| **startButton** | string | Start button. Appears below the title and any description. |
| **startButton.text** | string | Text for the start button. Default is `'Get started'`. |
| **startButton.href** | string | The URL that the start button should link to. |
| **image** | object | Product image. Appears to the right of the page title, and is hidden on mobile. |
| **image.src** | string | Path to product image. |
| **image.alt** | string | Alternative text for product image. |
{% from "govuk/components/table/macro.njk" import govukTable %}
{{ govukTable({
firstCellIsHeader: true,
head: [
{ text: "Name" },
{ text: "Type" },
{ text: "Description" }
],
rows: [
[
{ text: "startButton" },
{ text: "object" },
{ text: "Start button. Appears below the title and any description." }
],
[
{ text: "startButton.text" },
{ text: "string" },
{ text: "Text for the start button (default is `'Get started'`)." | markdown }
],
[
{ text: "startButton.href" },
{ text: "string" },
{ text: "URL or page the start button should link to." }
],
[
{ text: "image" },
{ text: "object" },
{ text: "Product image. Appears to the right of the page title, and is hidden on mobile." }
],
[
{ text: "image.src" },
{ text: "string" },
{ text: "Path to product image." }
],
[
{ text: "image.alt" },
{ text: "string" },
{ text: "Alternative text for product image." }
]
]
}) }}
19 changes: 16 additions & 3 deletions docs/layouts/sub-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ Page content

In addition to [common front matter options](/layouts#common-front-matter-options), this layout also accepts the following options:

| Name | Type | Description |
| :------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **sectionKey** | string | Parent navigation key (usually a page title) to show items below in the sub navigation. Default is `homeKey` value provided in [plugin options](/options). |
{% from "govuk/components/table/macro.njk" import govukTable %}
{{ govukTable({
firstCellIsHeader: true,
head: [
{ text: "Name" },
{ text: "Type" },
{ text: "Description" }
],
rows: [
[
{ text: "sectionKey" },
{ text: "string" },
{ text: "Parent navigation key (usually a page title) to show items below in the sub navigation. Default is `homeKey` value provided in [plugin options](/options)." | markdown }
]
]
}) }}
Loading

0 comments on commit e666e62

Please sign in to comment.