diff --git a/README.md b/README.md index 72d9af1..9d46e7e 100644 --- a/README.md +++ b/README.md @@ -1,129 +1,3 @@ # GOV.UK Prototype Components · [![test](https://github.com/x-govuk/govuk-prototype-components/actions/workflows/test.yml/badge.svg)](https://github.com/x-govuk/govuk-prototype-components/actions/workflows/test.yml) -GOV.UK Prototype Components contains the code you need to use common or experimental components that are not yet in the GOV.UK Design System. - -These components are currently experimental and more research is needed to validate them. - -| Component | Description | -| - | - | -| [xGovukAutocomplete](https://x-govuk.github.io/govuk-prototype-components/autocomplete/) | Implements the [Accessible autocomplete pattern](https://github.com/alphagov/accessible-autocomplete) to enhance a fixed list of options provided by a `` element. This component may be useful if you want users to pick from a number of options. Unlike an autosuggest component, this component will only allow users to choose from a predetermined list of options. -## Example usage - -```njk -{{ xGovukAutocomplete({ - id: "country", - name: "country", - allowEmpty: false, - label: { - classes: "govuk-label--l", - isPageHeading: true, - text: "Pick a country" - }, - items: [ - { text: "Austria" }, - { text: "Belgium" }, - { text: "Bulgaria" }, - { text: "Croatia" }, - { text: "Republic of Cyprus" }, - { text: "Czech Republic" }, - { text: "Denmark" }, - { text: "Estonia" }, - { text: "Finland" }, - { text: "France" }, - { text: "Germany" }, - { text: "Greece" }, - { text: "Hungary" }, - { text: "Ireland" }, - { text: "Italy" }, - { text: "Latvia" }, - { text: "Lithuania" }, - { text: "Luxembourg" }, - { text: "Malta" }, - { text: "Netherlands" }, - { text: "Poland" }, - { text: "Portugal" }, - { text: "Romania" }, - { text: "Slovakia" }, - { text: "Slovenia" }, - { text: "Spain" }, - { text: "Sweden" } - ] +{% from "example/macro.njk" import appExample %} + +{{ appExample({ + component: "autocomplete" }) }} -``` ## Component options diff --git a/x-govuk/components/edge/README.md b/docs/edge.md similarity index 96% rename from x-govuk/components/edge/README.md rename to docs/edge.md index dcb14e5..442961f 100644 --- a/x-govuk/components/edge/README.md +++ b/docs/edge.md @@ -1,4 +1,8 @@ -# Edge +--- +title: Edge +layout: sub-navigation +order: 2 +--- A javascript component to make it easy to define the edges of your prototype for research. diff --git a/docs/examples/autocomplete.njk b/docs/examples/autocomplete.njk new file mode 100644 index 0000000..76ff78e --- /dev/null +++ b/docs/examples/autocomplete.njk @@ -0,0 +1,46 @@ +--- +title: Autocomplete example +layout: example.njk +eleventyExcludeFromCollections: true +--- +{% from "x-govuk/components/autocomplete/macro.njk" import xGovukAutocomplete %} + +{{ xGovukAutocomplete({ + id: "country", + name: "country", + allowEmpty: false, + label: { + classes: "govuk-label--l", + isPageHeading: true, + text: "Pick a country" + }, + items: [ + { text: "Austria" }, + { text: "Belgium" }, + { text: "Bulgaria" }, + { text: "Croatia" }, + { text: "Republic of Cyprus" }, + { text: "Czech Republic" }, + { text: "Denmark" }, + { text: "Estonia" }, + { text: "Finland" }, + { text: "France" }, + { text: "Germany" }, + { text: "Greece" }, + { text: "Hungary" }, + { text: "Ireland" }, + { text: "Italy" }, + { text: "Latvia" }, + { text: "Lithuania" }, + { text: "Luxembourg" }, + { text: "Malta" }, + { text: "Netherlands" }, + { text: "Poland" }, + { text: "Portugal" }, + { text: "Romania" }, + { text: "Slovakia" }, + { text: "Slovenia" }, + { text: "Spain" }, + { text: "Sweden" } + ] +}) }} diff --git a/docs/examples/masthead.njk b/docs/examples/masthead.njk new file mode 100644 index 0000000..ef9241f --- /dev/null +++ b/docs/examples/masthead.njk @@ -0,0 +1,28 @@ +--- +title: Masthead example +layout: example.njk +eleventyExcludeFromCollections: true +--- +{% from "x-govuk/components/masthead/macro.njk" import xGovukMasthead %} + +{{ xGovukMasthead({ + classes: "x-govuk-masthead--large", + phaseBanner: { + text: "This is a new service" + }, + breadcrumbs: { + items: [{ + href: "/", + text: "Home" + }] + }, + title: { + text: "Design your service using GOV.UK styles, components and patterns" + }, + description: { + text: "Use this design system to make your service consistent with GOV.UK. Learn from the research and experience of other service teams and avoid repeating work that’s already been done." + }, + startButton: { + href: "/get-started/" + } +}) }} diff --git a/docs/examples/primary-navigation.njk b/docs/examples/primary-navigation.njk new file mode 100644 index 0000000..7289f62 --- /dev/null +++ b/docs/examples/primary-navigation.njk @@ -0,0 +1,17 @@ +--- +title: Primary navigation +layout: example.njk +eleventyExcludeFromCollections: true +--- +{% from "x-govuk/components/primary-navigation/macro.njk" import xGovukPrimaryNavigation %} + +{{ xGovukPrimaryNavigation({ + visuallyHiddenTitle: "Navigation", + items: [{ + text: "About this project", + href: "#" + }, { + text: "Contact us", + href: "#" + }] +}) }} diff --git a/docs/examples/related-navigation.njk b/docs/examples/related-navigation.njk new file mode 100644 index 0000000..3ee8b69 --- /dev/null +++ b/docs/examples/related-navigation.njk @@ -0,0 +1,25 @@ +--- +title: Related navigation example +layout: example.njk +eleventyExcludeFromCollections: true +--- +{% from "x-govuk/components/related-navigation/macro.njk" import xGovukRelatedNavigation %} + +{{ xGovukRelatedNavigation({ + sections: [{ + items: [{ + text: "Find and compare schools in England", + href: "/school-performance-tables" + }, { + text: "Types of school", + href: "/types-of-school" + }], + subsections: [{ + title: "Explore the topic", + items: [{ + text: "Schools and curriculum", + href: "/browse/education/school-life" + }] + }] + }] +}) }} diff --git a/docs/examples/sub-navigation.njk b/docs/examples/sub-navigation.njk new file mode 100644 index 0000000..01e9a49 --- /dev/null +++ b/docs/examples/sub-navigation.njk @@ -0,0 +1,26 @@ +--- +title: Sub navigation example +layout: example.njk +eleventyExcludeFromCollections: true +--- +{% from "x-govuk/components/sub-navigation/macro.njk" import xGovukSubNavigation %} + +{{ xGovukSubNavigation({ + visuallyHiddenTitle: "Navigation", + items: [{ + text: "About this project", + href: "/about" + }, { + text: "Contact us", + href: "/contact", + current: true, + parent: true, + children: [{ + text: "By email", + href: "/contact/email" + }, { + text: "By telephone", + href: "/contact/telephone" + }] + }] +}) }} diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..414b1e8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,135 @@ +--- +homepage: true +layout: product +includeInBreadcrumbs: true +title: GOV.UK Prototype Components +description: Common and experimental components that are not yet part of the GOV.UK Design System +--- + +GOV.UK Prototype Components contains the code you need to use common or experimental components that are not yet in the GOV.UK Design System. + +These components are currently experimental and more research is needed to validate them. + +| Component | Description | +| - | - | +| [xGovukAutocomplete](/autocomplete) | Implements the [Accessible autocomplete pattern](https://github.com/alphagov/accessible-autocomplete) to enhance a fixed list of options provided by a `