Skip to content

acteng/ate-frontend

Repository files navigation

ATE Frontend

Active Travel England templates and styles for the web.

Compatibility

The following version matrix details the compatibility between this project and other frontend components:

ATE Frontend GOV.UK Frontend GOV.UK One Login Service Header
0.1.0 (unreleased) 6.1.0 5.0.0 (uses GOV.UK Frontend 5.13.0)

Components

This project provides the following components.

ATE header

The ATE header component tell users that they're using an ATE service. It replaces the GOV.UK logo in the GOV.UK header with the ATE logo.

Screenshot of the ATE header

Use with the Nunjucks macro:

{% from "ate/components/ate-header/macro.njk" import ateHeader %}

{{ ateHeader({}) }}

The macro supports all the GOV.UK header options, plus:

Name Type Description
assetPath string Specify a path to the ATE Frontend assets.

ATE footer

The ATE footer component provides copyright, licensing and other information about your service. It removes the GOV.UK logo from the GOV.UK footer.

Screenshot of the ATE footer

Use with the Nunjucks macro:

{% from "ate/components/ate-footer/macro.njk" import ateFooter %}

{{ ateFooter({}) }}

The macro supports all the GOV.UK footer options.

ATE service header

The ATE service header component tell users that they're logged into an ATE service. It replaces the GOV.UK logo in the GOV.UK One Login service header with the ATE logo.

Screenshot of the ATE service header

Use with the Nunjucks macro:

{% from "ate/components/ate-service-header/macro.njk" import ateServiceHeader %}

{{ ateServiceHeader({}) }}

The macro supports all the GOV.UK One Login service header options, plus:

Name Type Description
assetPath string Specify a path to the ATE Frontend assets.

Using with Node.js

Install ATE Frontend to use the templates and styles in your Node.js project.

Installing

To install ATE Frontend:

npm install @active-travel-england/ate-frontend

Configuring the templates

Configure Nunjucks to find the components by adding the template path:

nunjucks.configure([
    "node_modules/@active-travel-england/ate-frontend/dist"
]);

Serving the assets

Configure your application to serve the assets. For example, using Express:

app.use("/assets", express.static("node_modules/@active-travel-england/ate-frontend/dist/ate/assets"));

Use this path when configuring the component option assetPath in your templates. For example:

{{ ateHeader({
    assetPath: "/assets"
}) }}

Serving the styles

You can either use the prebuilt files or build them yourself in your project.

To use the prebuilt files:

  1. Configure your application to serve the styles. For example, using Express:

    app.use("/styles/ate-frontend.min.css", express.static("node_modules/@active-travel-england/ate-frontend/dist/ate/ate-frontend.min.css"));
  2. Add the CSS file to your pages:

    <head>
        <link rel="stylesheet" href="/styles/ate-frontend.min.css">
    </head>

Alternatively, if your project already uses Sass then import the styles to build them yourself:

@import "node_modules/@active-travel-england/ate-frontend/dist/ate";

Using with the Prototype Kit

This project can also be used as a plugin for the GOV.UK Prototype Kit.

Installing

  1. Create a new prototype

  2. Install ATE Frontend:

    npm install @active-travel-england/ate-frontend
  3. Install the GOV.UK One Login service header that is used by ATE Frontend:

    npm install @govuk-one-login/service-header
  4. Configure the GOV.UK Frontend settings for ATE branding by creating app/assets/sass/settings.scss:

    @use "node_modules/@active-travel-england/ate-frontend/dist/ate/settings";
    
    $govuk-font-family: settings.$ate-font-family;
    $govuk-functional-colours: settings.$ate-functional-colours;
  5. Change the default layout app/views/layouts/main.html to use the ATE branding:

    -{% extends "govuk-prototype-kit/layouts/govuk-branded.njk" %}
    +{% extends "ate/layouts/prototype/template.njk" %}

Templates

Templates are used to create pages. This plugin provides the following templates:

  • Blank ATE page - uses the ATE header and footer
  • Blank ATE service page - uses the ATE service header and footer

Learn how to create pages from templates in a prototype.

Layouts

Layouts are used to share a common design across pages. This plugin provides the following layouts:

  • ate/layouts/prototype/template.njk - uses the ATE header and footer
  • ate/layouts/prototype/service-template.njk - uses the ATE service header and footer

These layouts support all the GOV.UK page template blocks and options, specifically:

Name Type Description
opengraphImageUrl Variable Specify an absolute URL to the ATE Frontend Open Graph image ate-icons/ate-opengraph-image.png
themeColor Variable Defaults to the DfT organisation colour

Learn how to use layouts in a prototype.

Building

To build the package:

npm run build

The package files are in the directory dist.

See also

Licence

MIT License

About

Active Travel England templates and styles for the web.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors