-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #780 from daniel-ac-martin/error-summary
Add ErrorSummary component
- Loading branch information
Showing
13 changed files
with
649 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist/ | ||
node_modules/ | ||
package-lock.json | ||
pnpm-lock.yaml | ||
tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
NotGovUK - Error Summary | ||
======================== | ||
|
||
A component to summarise any errors a user has made. | ||
|
||
|
||
Using this package | ||
------------------ | ||
|
||
First install the package into your project: | ||
|
||
```shell | ||
npm install -S @not-govuk/error-summary | ||
``` | ||
|
||
Then use it in your code as follows: | ||
|
||
```js | ||
import React, { createElement as h } from 'react'; | ||
import ErrorSummary from '@not-govuk/error-summary'; | ||
|
||
export const MyComponent = props => ( | ||
<ErrorSummary | ||
title="There is a problem" | ||
items={[ | ||
{ | ||
text: "The date your passport was issued must be in the past", | ||
href: "#" | ||
}, | ||
{ | ||
text: "Enter a postcode, like AA1 1AA", | ||
href: "#" | ||
} | ||
]} | ||
/> | ||
); | ||
|
||
export default MyComponent; | ||
``` | ||
|
||
|
||
Working on this package | ||
----------------------- | ||
|
||
Before working on this package you must install its dependencies using | ||
the following command: | ||
|
||
```shell | ||
pnpm install | ||
``` | ||
|
||
|
||
### Testing | ||
|
||
Run the unit tests. | ||
|
||
```shell | ||
npm test | ||
``` | ||
|
||
|
||
### Building | ||
|
||
Build the package by compiling the TypeScript source code. | ||
|
||
```shell | ||
npm run build | ||
``` | ||
|
||
|
||
### Clean-up | ||
|
||
Remove any previously built files. | ||
|
||
```shell | ||
npm run clean | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import "@not-govuk/sass-base"; | ||
@import "govuk-frontend/govuk/components/error-summary"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const baseConfig = require('../../jest.config.base'); | ||
|
||
const config = { | ||
...baseConfig, | ||
collectCoverageFrom: [ | ||
'<rootDir>/src/**.{ts,tsx}', | ||
], | ||
testMatch: [ | ||
'<rootDir>/spec/**.{ts,tsx}' | ||
] | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "@not-govuk/error-summary", | ||
"version": "0.7.2", | ||
"description": "A component to summarise any errors a user has made.", | ||
"main": "src/ErrorSummary.tsx", | ||
"sass": "assets/ErrorSummary.scss", | ||
"publishConfig": { | ||
"main": "dist/ErrorSummary.js", | ||
"typings": "dist/ErrorSummary.d.ts" | ||
}, | ||
"files": [ | ||
"/assets", | ||
"/dist" | ||
], | ||
"scripts": { | ||
"test": "NODE_OPTIONS=--experimental-vm-modules jest", | ||
"prepublishOnly": "npm run clean && npm run build", | ||
"build": "tsc", | ||
"clean": "rm -rf dist tsconfig.tsbuildinfo" | ||
}, | ||
"author": "Daniel A.C. Martin <npm@daniel-martin.co.uk> (http://daniel-martin.co.uk/)", | ||
"license": "MIT", | ||
"keywords": [ | ||
"react-components" | ||
], | ||
"dependencies": { | ||
"@not-govuk/anchor-list": "workspace:^0.7.2", | ||
"@not-govuk/component-helpers": "workspace:^0.7.2", | ||
"@not-govuk/sass-base": "workspace:^0.7.2", | ||
"govuk-frontend": "4.6.0" | ||
}, | ||
"peerDependencies": { | ||
"@not-govuk/docs-components": "^0.7.2", | ||
"@storybook/addon-docs": "^6.4.0", | ||
"react": "^16.9.55" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@not-govuk/docs-components": { | ||
"optional": true | ||
}, | ||
"@storybook/addon-docs": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@mdx-js/react": "1.6.22", | ||
"@not-govuk/checkboxes": "workspace:^0.7.2", | ||
"@not-govuk/component-test-helpers": "workspace:^0.7.2", | ||
"@not-govuk/date-input": "workspace:^0.7.2", | ||
"@not-govuk/page": "workspace:^0.7.2", | ||
"@not-govuk/text-input": "workspace:^0.7.2", | ||
"@types/react": "16.14.32", | ||
"jest": "29.2.2", | ||
"jest-environment-jsdom": "29.2.2", | ||
"ts-jest": "29.0.3", | ||
"typescript": "4.8.4" | ||
} | ||
} |
Oops, something went wrong.
cc358f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://not-gov.uk as production
🚀 Deployed on https://6449849a0baec55f8c62408a--notgovuk.netlify.app