Skip to content

Commit 74fec5f

Browse files
committed
FCL-631 | add front-end ADRS
1 parent 4c88564 commit 74fec5f

24 files changed

+1096
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 22. TNA Front-end colours override
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We are using the TNA colour values provided from the TNA front-end library, however the colours available don't quite match up with the use cases we have in Find Case Law.
14+
15+
### Problem
16+
17+
Because we don't have colours that match up with features and areas on the website, the features don't look right.
18+
19+
### Goals
20+
21+
Introduce a way to have colours that match the features we have on the Find Case Law website.
22+
23+
### Options considered
24+
25+
- Look at using a different colour scheme/not use the TNA colours
26+
- Add extra colours that aren't part of the TNA colour scheme and mix and match the two
27+
- Override the relevant TNA colours that don't match the Find Case Law features
28+
29+
## Decision
30+
31+
### Proposed solution
32+
33+
Override the relevant TNA colours by importing the SCSS variable map into our application and override the relevant colours.
34+
35+
### Justification
36+
37+
This allows us to continue using colours that we chose to use in the colour variable ADR, however we will still have the flexibility of modifying colour values to fit the features in Find Case Law.
38+
39+
## Consequences
40+
41+
- We need to maintain a divergence from the TNA colours scheme
42+
- If the TNA colour variable map changes naming or format upstream, we will need to modify our code
43+
- The colours we use may not be as accessible as the TNA colour schema

doc/adr/0023-style-lint.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# 23. Style Lint
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We have a basic configuration of Style Lint that runs on a pre-commit hook.
14+
15+
### Problem
16+
17+
Our installation of style lint only has a basic configuration that doesn't lint our CSS properly to ensure consistent CSS throughout our app.
18+
19+
### Goals
20+
21+
We want to have automated style linting so can have consistent and standardised CSS without a large amount of manual intervention when composing CSS and also in the review process.
22+
23+
### Options considered
24+
25+
- Use the stylelint-selector-bem library to ensure bem classes
26+
- Use stylelint-clean-order library to ensure valid css order
27+
- Use stylelint-standard-css
28+
- Create a custom selector class pattern for bem classes
29+
- Have a style lint configuration file per repository
30+
- Have a style lint configuration file shared that can be used by all relevant repositories
31+
32+
## Decision
33+
34+
### Proposed solution
35+
36+
- Use stylelint-clean order and stylelint-standard-css libraries
37+
- Create a custom selector class pattern for bem classes
38+
- Have a shared style lint configuration but allow each repository to extend that configuration file as necessary
39+
40+
### Justification
41+
42+
- The stylelint-clean-order and stylelint-standard-css libraries work well out of the box and save us writing our own rules
43+
- The stylelint-selector-bem library does not work out of the box and the configuration needed is the equivalent of just writing your own selector class.
44+
- Allowing the shared style lint configuration to be customised likely won't be needed too much, however it allows for flexibility should it be needed
45+
46+
## Consequences
47+
48+
- We will need to maintain our own bem selector function - however, the BEM specification is likely to change and so shouldn't need any changes
49+
- Allowing the shared configuration to be customised could mean slight deviation in in CSS across repos
50+
- When we make a change to the style-lint, we will need to update the relevant downstream repositories with the new changes and then update any offending CSS
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# 24. Usage of GOV.UK Front-end
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
The Find Case Law website is a public government service. The GOV.UK front-end library has various useful components that are built to be used by government services.
14+
15+
### Problem
16+
17+
We want to build various features on the Find Case Law website at pace without having to build everything from scratch, and we want these features to use components that are accessible and work in a standard way.
18+
19+
### Goals
20+
21+
- Build features on the Find Case Law website that are accessible
22+
- Build features on the Find Case Law website at pace
23+
- Build features on the Find Case law that work in an industry standard way
24+
- Have minimal code to maintain
25+
26+
### Options considered
27+
28+
- Build our own component library from scratch
29+
- Add the GOV.UK front-end library as a dependency and override any styling that doesn't match Find Case Law
30+
- Create a copy of the GOV.UK component library and make changes to the core code for styles that doesn't match Find Case Law
31+
- Use a non-government supported component library and style it to match the Find Case Law branding
32+
33+
## Decision
34+
35+
### Proposed solution
36+
37+
- Add the GOV.UK front-end library as a dependency
38+
- Override styling that doesn't match Find Case law
39+
- Ensure the CSS for overriding is as decoupled from our application as possible
40+
- Ensure the HTML for usage of the components is decoupled from our application as possible by creating Find Case Law equivalent components that inherit from the GOV.UK components
41+
42+
### Justification
43+
44+
- By adding the GOV.UK front-end library as a dependency, we will get any new features and changes that happen upstream
45+
- By overriding styling that doesn't match Find Case Law, it means we'll have less breaking changes when we update the library and we don't couple our styling heavily with the usage of the library
46+
- By using our own component HTML that inherits/uses the HTML from the GOV.UK front-end library, and decoupling our application from the GOV.UK front-end components, it allows updating the GOV.UK front-end library with minimal breaking changes
47+
48+
## Consequences
49+
50+
- We can build new features at pace without having to build too much
51+
- New components and features will be accessible
52+
- By decoupling the implementation of the GOV.UK front-end library, it requires minimal maintenance and a smaller blast radius when breaking changes happen upstream
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# 25. Usage of Home Office Front-end
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We have a number of different alert components used within the application.
14+
15+
### Problem
16+
17+
Having multiple different styles of alert components from different libraries creates an inconsistent experience for users and also means we have multiple components to maintain.
18+
19+
### Goals
20+
21+
- An alert component that is consistent throughout
22+
- Minimal maintenance with an alert component
23+
- An accessible alert component
24+
- Styled to match the Find Case Law service
25+
26+
### Options considered
27+
28+
- Custom built alert component
29+
- GOV.UK alert component
30+
- TNA front-end alert component
31+
- Home office alert component
32+
33+
## Decision
34+
35+
### Proposed solution
36+
37+
Use the home office alert component, but don't include the whole library - just take a copy of this specific component.
38+
39+
### Justification
40+
41+
It matches the style of the Find Case Law styles closest with minimal style changes.
42+
43+
## Consequences
44+
45+
- We will have a consistent alert component that matches the style we want in Find Case law
46+
- We need to manually maintain another external dependency for the sake of a single component
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 26. Playwright for end to end tests
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We want to have end to end tests across the Find Case Law website so that we can have confidence our service is working as expected while making changes and implementing new features.
14+
15+
### Problem
16+
17+
Testing the service end to end is currently a manual process and takes a lot of time. Doing this end to end test manually also gets forgotten and it means potentially areas of the website that are less frequently used may get broken without anybody noticing.
18+
19+
### Goals
20+
21+
- Have end to end tests for the key paths within the Find Case Law website
22+
- Have end to end tests that can be run automatically in CI/CD
23+
- Use a standard/well maintained library
24+
- Have the tests written in a language that all developers can write the tests for
25+
26+
### Options considered
27+
28+
- Cypress
29+
- Playwright
30+
- Capybara
31+
- Puppeteer
32+
33+
## Decision
34+
35+
### Proposed solution
36+
37+
Playwright
38+
39+
### Justification
40+
41+
Playwright is the only option that allows writing the test in python which is the language all the developers can write code in. It is also very well maintained and the most standard option available.
42+
43+
## Consequences
44+
45+
- End to end tests for all key user paths need to be written and maintained
46+
- We will have confidence the service is working as intended while making changes and adding new features
47+
- When we change the key user paths within the service, we will need to update the relevant end to end tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 27. Automated accessibility checking
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We want to automate our accessibility testing
14+
15+
### Problem
16+
17+
Accessibility testing across the Find Case law service is a manual process, with a number of approaches that could be taken without much consistency. During the development process accessibly is often forgotten as it's not necessarily easy to remember all the various accessibility best practices when building websites.
18+
19+
### Goals
20+
21+
- Have an automated way of flagging accessibility issues in our code
22+
- Ensure the accessibility tests are standardised and catch issues that would be raised in a normal accessibility audit
23+
24+
### Options considered
25+
26+
- Use a service like BrowserStack
27+
- Use PA11Y
28+
- Use Axe-Core
29+
- Use Wave chrome extension with a test script
30+
- Use Axe-playwright
31+
32+
## Decision
33+
34+
### Proposed solution
35+
36+
Add the axe-playwright library to our existing automated test and automatically do an accessibility check on all pages covered by our end to end testing suite.
37+
38+
### Justification
39+
40+
- Easiest option to add into our existing testing setup
41+
- Has standardised tests and covers the main accessibility checks
42+
- Already works with our CI/CD
43+
44+
## Consequences
45+
46+
- All our pages covered by end to end tests will have an accessibility check against them ensuring our key user journeys are accessible
47+
- Pages that we want to automatically check their accessibility will need a playwright test added
48+
- If we implement large features without checking for accessibility, they will need to be fixed before code can be merged and released

doc/adr/0028-sass-for-all-css.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 28. Using SASS for all CSS
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
We need to style the Find Case Law front-end.
14+
15+
### Problem
16+
17+
Styling applications in pure CSS is inefficient and prone to causing inconsistencies.
18+
19+
### Goals
20+
21+
- Simple, easy solution to writing efficient CSS
22+
- Reduce duplication and promote sharing shared CSS
23+
- Have the ability to compile performant CSS and reduce duplication
24+
25+
### Options considered
26+
27+
- Pure CSS
28+
- LESS
29+
- SCSS
30+
- Stylus
31+
- PostCSS
32+
33+
## Decision
34+
35+
### Proposed solution
36+
37+
Use SCSS throughout all Find Case Law front-end styling.
38+
39+
### Justification
40+
41+
- Used across most government public service applications
42+
- Allows easily using external government supported libraries like GOV.UK front-end
43+
- Allows writing simple, efficient CSS
44+
- Can share CSS via mixins
45+
- Can use it to compile performant CSS
46+
47+
## Consequences
48+
49+
- We'll be able to easily use SCSS supported libraries
50+
- We can use GOV.UK front-end library and import their CSS into our components
51+
- Our CSS will be efficient, simple and we will be able to reduce duplication
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 29. CSS Spacing Variable Convention
2+
3+
Date: 2025-02-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
### Background
12+
13+
Spacing values across the application are inconsistent and don't follow a convention.
14+
15+
### Problem
16+
17+
Not having a standard spacing convention creates inconsistencies in the user experience, the design of the website and increases the amount of maintenance needed for making changes to spacing.
18+
19+
### Goals
20+
21+
- Allow for better consistency throughout the Find Case Law front-end
22+
- Reduce the maintenance cost when updating spacing across the website
23+
- Have a convention to follow to allow making changes at pace
24+
25+
### Options considered
26+
27+
- Use SCSS functions to generate spaces from a base size, i.e. calc(base-size \* 1.5)
28+
- Have a static number of variables that follow a naming convention based on their size, i.e. "xs" for a small size, and "xl" for a large size
29+
- Have a static number of variables that follow a numerical naming convention based on their space, i.e. "space-1" for a small size
30+
- Have variables that directly mimic their value, i.e. "space-1" would be "1rem"
31+
32+
## Decision
33+
34+
### Proposed solution
35+
36+
Have a static number of variables that follow a numerical naming convention based on their space, i.e. "space-1"
37+
38+
### Justification
39+
40+
All options potentially allow for consistency, however:
41+
42+
- Using CSS functions increase the cognitive complexity when reading the SCSS as it's not immediately clear what the output from the function would be
43+
- Having a static number of variables that follow a naming convention based on their size also does not make it immediately clear what the value could be in relation to others.
44+
- Having variables that mimic their value directly mean when a value on a variable updates, the variable has to update to, making using a variable at all redundant
45+
46+
Using a static number of variables that follow a numerical naming convention allows for consistency, reduces the maintenance cost of updating space as the values aren't tied to the variable name and makes it easy to understand the sizing variables relatively when building components.
47+
48+
## Consequences
49+
50+
- Consistent user experience as spacing across the website won't be slightly different in various places
51+
- Make it easy to update and build new features with a clear convention to follow

0 commit comments

Comments
 (0)