Giter Club home page Giter Club logo

assets-frontend's Introduction

Deprecation

🚨 Assets Frontend has been deprecated in favour of the Play Frontend. 🚨

If you do decide to use Assets Frontend anyway you need to be aware of the vulnerabilities including but not limited to the ones listed here ]https://github.com/hmrc/assets-frontend/security/dependabot](https://github.com/hmrc/assets-frontend/security/dependabot). There are also known accessibility issues when using Assets Frontend which will cause delays with going live. As of 13th October 2021, we won't be making updates to Assets Frontend so we recommend moving over to the latest Play Frontend Libraries

assets-frontend

This repository contains the source files and documentation for the Components & Design Patterns used to design and build digital services for the HMRC Tax Platform.

It provides additional styles on top of the GOV.UK styles.

Quick Start

Requirements

To install multiple versions of Node.js, you may find it easier to use a node version manager:

Installation

Clone this repository and install its dependencies:

$ git clone https://github.com/hmrc/assets-frontend.git
$ cd assets-frontend
$ npm install

Running

The Component Library microsite

  1. Clone the repo locally: git clone https://github.com/hmrc/assets-frontend.git
  2. In your file system, navigate to the assets-frontend directory: cd assets-frontend
  3. Checkout the gh-pages branch: git checkout gh-pages
  4. In your file system, navigate one directory level above the assets-frontend folder: cd ../
  5. Start a local server for serving the pages: python3 -m http.server --cgi 8888
  6. In the browser, navigate to to http://localhost:8888/assets-frontend

The Design System:

  1. Run npm start
  2. The Design System is available at http://localhost:9034/
  3. Latest V4 Assets are then available at http://localhost:9032/assets/v4-SNAPSHOT/...
  4. Latest V3 Assets are then available at http://localhost:9032/assets/v3-SNAPSHOT/...

To access both the Design System and the Component Library [DEPRECATED]

  1. Run npm run dev:all or ./server.sh dev
  2. The Design System is available at http://localhost:9034/
  3. The Component Library is available at http://localhost:9033/

To run a specific version of Assets Frontend locally

  1. Run ./server.sh
  2. V4 Assets are then available at http://localhost:9032/assets/4.11.0/...
  3. V3 Assets are then available at http://localhost:9032/assets/3.11.0/...

Usage

Using assets locally

Prototypes

For now, the quickest and simplest way to add assets-frontend to your prototype is to grab the built CSS and JS from production.

Just replace <VERSION> in the links below with the released version you want to use (we recommend using the latest).

If your prototype is based on the GOV.UK prototype kit then do the following:

CSS

Save the file found at https://www.tax.service.gov.uk/assets/<VERSION>/stylesheets/application.min.css to /app/assets/sass/assets-frontend.css.

And add the following to app/views/includes/head.html:

<link href="/public/stylesheets/assets-frontend.css" rel="stylesheet" type="text/css" />

JavaScript

Save the file found at https://www.tax.service.gov.uk/assets/<VERSION>/javascripts/application.min.js to /app/assets/javascripts/assets-frontend.js

And add the following to app/views/includes/head.html

<script src="/public/javascripts/assets-frontend.js"></script>

Frontends

If your frontend is based on init-service, then you just need to make sure the configuration for assets in the application.conf file has the line version = ${?ASSETS_FRONTEND_VERSION} after declaring the actual version.

Once it has, you just need to set an environment variable before running your frontend:

$ ASSETS_FRONTEND_VERSION=999-SNAPSHOT sbt run

If you’re using service-manager, please read the service manager guidance in the Wiki.

Using assets in production

Running npm run release calls the release gulp task and this happens on our internal Jenkins instances.

The final step of our internal release pipeline is to version and deploy the compiled assets to https://www.tax.service.gov.uk/assets/.

Releasing assets for use in production is currently a process owned by the Service Design Tools team.

If you’d like a new version of assets-frontend released, please get in touch with us in the #team-sdt Slack channel.

HMRC Design System

The HMRC Design System can be viewed here.

For detailed information on how the HMRC Design System works, please read the Design System page in the Wiki.

Component Library - [DEPRECATED]

🚨 The Component Library has been deprecated in favour of the HMRC Design System.🚨

If your service relies on a component or pattern that doesn’t appear in the HMRC Design System then please follow the Design System contribution guidelines.

For detailed information on how the Component Library works, please read the Component Library guidance in the Wiki.

Contributing

Design Patterns

For details on how to contribute Design Patterns, please take a few minutes to review our Design Pattern standards and contribution process before you submit your request, otherwise it may be rejected.

Features and issues

If you’ve spotted an issue or thought of a feature that you’d like to contribute to assets-frontend, please take a few minutes to review our contribution process and guidelines for Assets Frontend before you submit your request, otherwise it may be rejected.

License

This code is open source software licensed under the Apache 2.0 License.

assets-frontend's People

Contributors

adamconder avatar adamliptrot-oc avatar anthonymunene avatar benaveryee avatar cepoole avatar cookchristopher avatar csabascript avatar dependabot[bot] avatar ellamdav avatar feedmypixel avatar gavinwye avatar gordonmcmullan avatar ian-leggett avatar jennifer-hodgson avatar jopintopaul avatar matthewmascord avatar mikeash82 avatar muhammad-ali-ahmad avatar nataliecarey avatar nkashyap avatar paul-haine avatar peppereddev avatar rbangay avatar richiv avatar rpowis avatar sheldongold avatar stevenaproctor avatar stingrayfunk avatar timsb avatar tmikus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

assets-frontend's Issues

iOS 8.0 + VoiceOver does not read out legends

Having the following markup using fieldset/legends on iOS 8.0+ maeans that the legend does not get read out.

<fieldset id="earnings-per-week" class="form-group inline  ">
<legend>Do you expect to earn at least £52 a week (or £226 a month) on average?</legend>
<span class="form-hint">This can be from employment, self-employment or both.</span>
<label for="earnings-per-week-true" class=" block-label ">
        <input id="earnings-per-week-true" name="earnings-per-week" value="true" checked="" type="radio">
        Yes
</label>
<label for="earnings-per-week-false" class=" block-label ">
        <input id="earnings-per-week-false" name="earnings-per-week" value="false" type="radio">
        No
</label>
</fieldset>

http://stackoverflow.com/a/13269310
http://stackoverflow.com/questions/13943941/iphone-web-form-prev-next-skips-radio-buttons-how-to-fix

Design Request: Underline Clickable Text Of Expand/Collapse Component

Problem

For expand/collapse components (details/summary tags), currently the clickable blue text is not underlined.

screen shot 2016-03-01 at 4 18 06 pm

Proposed Solution

Either:

  • Make a design decision as to whether these clickable expand/collapse links should be underlined.
  • Provide an optional modifier so that designers can underline the clickable text in their service, though this makes the component inconsistent across the services and is not recommended.

screen shot 2016-02-29 at 3 26 12 pm

Vertical rhythm and $baseline variable

We need to have a look at vertical rhythm and $baseline variables on type elements such as the p tag so we can have a much more "drop in" feel to writing html and adding css selectors.

For instance writing a .form-hint using a paragraph element gives a margin that looks incorrect and you end up having to use a .flush helper or change the markup to override.

Needs design input.

Document modules for component library

Base

  • Buttons
  • Colours
  • Details/Summary
  • Forms
  • Grid
  • Helpers
  • Icons
  • Layouts
  • Links
  • Lists
  • Tables
  • Typography

Modules

  • Accordion
  • Add/Remove
  • App Info
  • Attorney Banner
  • Autocomplete
  • Breadcrumbs
  • Character Counter
  • Code
  • Dashboard
  • Datatables
  • Dividers
  • External Markup
  • Footer
  • Header
  • Help Contents
  • Hero
  • Modal Dialog
  • Navigation
  • Notice Banner
  • Notifications
  • Organisation Logo
  • Page Header
  • Panel
  • Phase Alpha
  • Phase Beta
  • Reminders
  • Report Error
  • Service Info
  • Side Navigation
  • Tabs
  • Tabular Data
  • Template Footer
  • Template Page Header
  • Template Service Info
  • Template Sidebar
  • Toggle Button
  • Toggle
  • Youtube Player

Rename .flash selector to avoid modernizr conflicts

Using an auto-generated modernizr build tool, the stylesheets are scraped for class names matching modernizr classes.

.flash is used for detecting Flash so when the page loads we end up targeting both <html> as well as any notifications on the page.

iOS 8.0+ VoiceOver accessibility radio buttons

Radio buttons are skipped entirely when using VoiceOver and gesturing between the elements on the page.
iOS only focuses on fields.

Example markup:

<fieldset id="earnings-per-week" class="form-group inline  ">
<legend>Do you expect to earn at least £52 a week (or £226 a month) on average?</legend>
<span class="form-hint">This can be from employment, self-employment or both.</span>
<label for="earnings-per-week-true" class=" block-label ">
        <input id="earnings-per-week-true" name="earnings-per-week" value="true" checked="" type="radio">
        Yes
</label>
<label for="earnings-per-week-false" class=" block-label ">
        <input id="earnings-per-week-false" name="earnings-per-week" value="false" type="radio">
        No
</label>
</fieldset>

As dicussed in the Frontend meetings in DDCN there could be a need for a mobile specific solution. Worth investigating.

Write Tests for components

Write tests for

Coverage needed

  • AutoComplete
  • Toggle
  • Control
  • Form Validation (Generic) ✓
  • Visibility
  • Masker

Add license

Please apply the apache 2.0 license to this repo

Update "Running locally" section of README

The Running locally section of the README should be expanded to include:

  • What the outcome of running AF locally is
  • The need to override a frontend's version with an ENV VAR and how
  • An updated list of commands that covers the above (see below)
$ export ASSETS_FRONTEND_VERSION=999-SNAPSHOT
$ cd /path/to/service/frontend
$ sbt run <SERVICE PORT>
$ cd /path/to/assets-frontend
$ ./server dev

Refactor detail and summary styles in page-specific stylesheet

There appears to be quite a few details styles specific to epaye statements.
https://github.com/hmrc/assets-frontend/blob/81040fc1fb77d0fb56a3a8b63246a761f578058f/assets/scss/modules/_epaye-statements.scss

There is also a mixin multi-line-summary-block that is being used just for epaye.
https://github.com/hmrc/assets-frontend/blob/master/assets/scss/base/_details-summary.scss

@mattpepper can these specific epaye details be aligned to the generic details or is there items there that can be made generic for all to use?

Enable markdown blockquotes

Blockquotes have no css applied to the element when used in markdown on component library.
Please add style as per markdown example below:

a "blockquote" example using the > markdown element

Put examples into documentation

Documentation

Examples found at the top of JavaScript files place into their own README.md and link from main README.

Coverage needed

  • AutoComplete
  • Toggle
  • Control
  • Form Validation (Generic)
  • Visibility
  • Masker

Design Request: Align Descriptive Text Below Expandable Section

Problem

Indenting some descriptive text to align with an expand/collapse section is not possible with our current components.

screen shot 2016-03-01 at 4 07 59 pm

Proposed Solution

Potentially update indent component to include a modifier which provides sufficient indentation.

screen shot 2016-03-01 at 3 38 12 pm

The expand/collapse buttons is the "Parsley" and "Fast Trax Tax" text. The grey text directly below them is the descriptive text.

Multiple *toggle JavaScript implementations

iOS 8.0 + VoiceOver cannot pass skip to content link

Running a service under iOS 8.0+ using the accessibility tool VoiceOver cannot pass the skip to main content link. Clicking this assumes it's worked as intended however the voice over technology stops.

Example markup:

screenshot from 2015-05-20 10 37 24

Multiple error styles around the codebase

We have multiple error styles in scss/base/form_errors. We have others around the codebase. These need to be in one place, play-ui work needs updating, then design need to decide what error style they want.

Bug: assets are not serving correctly past 2.2.0

The assets aren't being served correctly for assets-frontend after version 2.2.0.
For example:
/assets/2.3.0/images/icons/crests/hmrc_crest_27px.png
Returns the correct asset however it's not found and the http response says it contains data but it does not render.

Migrate input classes to BEM

There are classes in _form.scss which refer to elements within a class, e.g. ".block-label input"
This causes problems of overcoming specificity.
We should refactor these classes into BEM format.

Prevent defunct assets versions being downloaded by smserver

When the cache of downloaded versions is purged every historical version needs to be re-downloaded, taking a long time.

Perhaps an 'oldest version in production' could be recorded in a file and semantic versioning used to prevent the download of any versions prior to this.

Typo in assets/javascripts/modules/reportAProblem.js

"datattype" settings param should read "dataType"

BUT...

Given that the jQuery AJAX spec states:

"dataType (default: Intelligent Guess (xml, json, script, or html))..
If none is specified, jQuery will try to infer it based on the MIME type of the response.."

And the current typo'd datattype setting is invalid, jQuery will therefore already be trying to infer the dataType, I would suggest removing this settings param rather than correcting it, as there will be extensive testing involved in correcting, as this will change the existing behaviour, whereas removing it will not.

Design Request: Indent Lists Within Lists

Problem

Sometimes a bulleted lists appear within other list items, but are not indented. See below:

screen shot 2016-03-01 at 4 05 29 pm

Proposed Solution

  1. Provide indentation as a modifier to the list component, e.g. list--indent to indent by 20 pixels.
  2. Remove default margin bottom of 5 pixels for bulleted lists.

screen shot 2016-02-29 at 4 35 43 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.