Skip to content

Commit b846970

Browse files
author
Sine Jespersen
committed
Merge branch 'develop' into feature/intermediate-list
2 parents 0d74229 + 87ae450 commit b846970

File tree

60 files changed

+1014
-1344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1014
-1344
lines changed

README.md

Lines changed: 7 additions & 342 deletions
Original file line numberDiff line numberDiff line change
@@ -1,352 +1,17 @@
11
<!-- markdownlint-disable-next-line first-line-h1 -->
22
![https://detdigitalefolkebibliotek.dk/sites/default/files/ddf_logo_rgb_blue_web.png](https://detdigitalefolkebibliotek.dk/sites/default/files/ddf_logo_rgb_blue_web.png)
33

4-
<!-- markdownlint-disable -->
5-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
6-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
7-
8-
- [DPL Design System](#dpl-design-system)
9-
- [Requirements](#requirements)
10-
- [Manual requirements](#manual-requirements)
11-
- [Installation](#installation)
12-
- [Installation outside docker](#installation-outside-docker)
13-
- [Development](#development)
14-
- [Development without docker](#development-without-docker)
15-
- [Usage](#usage)
16-
- [NPM package](#npm-package)
17-
- [Deployment and releases](#deployment-and-releases)
18-
- [Tagged releases](#tagged-releases)
19-
- [Usage: npm package](#usage-npm-package)
20-
- [Usage: Release file](#usage-release-file)
21-
- [Branch releases](#branch-releases)
22-
- [Usage: npm package](#usage-npm-package-1)
23-
- [Usage: Release file](#usage-release-file-1)
24-
- [Storybook](#storybook)
25-
- [Chromatic](#chromatic)
26-
- [What is Storybook](#what-is-storybook)
27-
- [How to use](#how-to-use)
28-
- [Addons](#addons)
29-
- [Important to notice](#important-to-notice)
30-
- [Internal classes](#internal-classes)
31-
32-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
33-
<!-- markdownlint-enable -->
34-
354
# DPL Design System
365

376
DPL Design System is a library of UI components that should be used as a common
387
base system for "Danmarks Biblioteker" / "Det Digitale Folkebibliotek". The
39-
design is implemented
40-
with [Storybook](https://storybook.js.org/docs/react/get-started/introduction)
41-
/ [React](https://reactjs.org/) and is output with HTML markup and css-classes
8+
design is implemented with
9+
[Storybook](https://storybook.js.org/docs/react/get-started/introduction) /
10+
[React](https://reactjs.org/) and is output with HTML markup and css-classes
4211
through an addon in Storybook.
4312

44-
The codebase follows the naming that designers have used in Figma closely
45-
to ensure consistency.
46-
47-
## Requirements
48-
49-
This project comes with [go-task](https://github.com/go-task/task) and docker
50-
compose, hence the requirements are limited to having docker install and tasks.
51-
52-
### Manual requirements
53-
54-
This project can be used outside docker with the following requirements:
55-
56-
- `node 16`
57-
- `yarn`
58-
59-
Check in the terminal which versions you have installed with `node -v`.
60-
61-
## Installation
62-
63-
Use the tasks defined in `Taskfile` to run the project:
64-
65-
```shell
66-
task dev:install
67-
```
68-
69-
### Installation outside docker
70-
71-
Use the node package manager to install project dependencies:
72-
73-
```shell
74-
yarn install
75-
```
76-
77-
## Development
78-
79-
To start the docker compose setup in development simple use the `start` task:
80-
81-
```shell
82-
task dev:start
83-
```
84-
85-
To see the output from the compile process and start of storybook:
86-
87-
```shell
88-
task dev:logs
89-
```
90-
91-
Use `task` and tabulator key in the terminal to see the other predefined tasks:
92-
93-
```shell
94-
task dev:[TAB]
95-
```
96-
97-
### Development without docker
98-
99-
To start developing run:
100-
101-
```shell
102-
yarn dev
103-
```
104-
105-
Components and CSS will be automatically recompiled when making changes in the
106-
source code.
107-
108-
## Usage
109-
110-
The project is available in two ways and should be consumed accordingly:
111-
112-
1. As package in the local npm registry for this repository
113-
2. As a `dist.zip` file attached to a release for this repository
114-
115-
Both releases contain the built assets of the project: JavaScript files, CSS
116-
styles and icons.
117-
118-
You can find the HTML output for a given story under the HTML tab inside
119-
storybook.
120-
121-
### NPM package
122-
123-
[The GitHub NPM package registry requires authentication if you are to access
124-
packages there](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token).
125-
126-
Consequently, if you want to use the design system as an NPM package or if you
127-
use a project that depends on the design system as an NPM package you must
128-
authenticate:
129-
130-
1. [Create a GitHub token with the required scopes: `repo` and `read:packages`](https://github.com/settings/tokens/new?description=npm&scopes=repo,read:packages)
131-
2. Run `npm login --registry=https://npm.pkg.github.com`
132-
3. Enter the following information:
133-
134-
```shell
135-
> Username: [Your GitHub username]
136-
> Password: [Your GitHub token]
137-
> Email: [An email address used with your GitHub account]
138-
```
139-
140-
Note that you will need to reauthenticate when your personal access token
141-
expires.
142-
143-
## Deployment and releases
144-
145-
The project is [automatically built and deployed](.github/workflows/deployment.yml)
146-
on pushes to every branch and every tag and the result is available as releases
147-
which support [both types of usage](#usage). This applies for the original
148-
repository on GitHub and all GitHub forks.
149-
150-
You can follow the status of deployments in the [Actions list for the repository
151-
on GitHub](https://github.com/danskernesdigitalebibliotek/dpl-design-system/actions/workflows/deployment.yml).
152-
The action logs also contain additional details regarding the contents and
153-
publication of each release. If using a fork then deployment actions can be
154-
seen on the corresponding list.
155-
156-
In general consuming projects should prefer tagged releases as they are stable
157-
proper releases.
158-
159-
During development where the design system is being updated in parallel with
160-
the implementation of a consuming project it may be advantageous to use a
161-
release tagging a branch.
162-
163-
### Tagged releases
164-
165-
Run the following to publish a tag and create a release:
166-
167-
```shell
168-
git tag -a v*.*.* && git push origin v*.*.*
169-
```
170-
171-
#### Usage: npm package
172-
173-
In the consuming project update usage to the new release:
174-
175-
```shell
176-
npm install @danskernesdigitalebibliotek/dpl-design-system@*.*.*
177-
```
178-
179-
#### Usage: Release file
180-
181-
Find the release for the tag on [the releases page on GitHub](https://github.com/danskernesdigitalebibliotek/dpl-design-system/releases)
182-
and download the `dist.zip` file from there and use it as needed in the
183-
consuming project.
184-
185-
### Branch releases
186-
187-
The project automatically creates a release for each branch.
188-
189-
Example: Pushing a commit to a new branch `feature/reservation-modal` will
190-
create the following parts:
191-
192-
1. A git tag for the commit `release-feature/reservation-modal`. A tag is needed
193-
to create a GitHub release.
194-
2. A GitHub release for the called *feature/reservation-modal*. The build is
195-
attached here.
196-
3. A package in the local npm repository tagged `feature-reservation-modal`.
197-
Special characters like `/` are not supported by npm tags and are converted
198-
to `-`.
199-
200-
Updating the branch will update all parts accordingly.
201-
202-
#### Usage: npm package
203-
204-
In the consuming project update usage to the new release:
205-
206-
```shell
207-
npm install @danskernesdigitalebibliotek/dpl-design-system@feature-reservation-modal
208-
```
209-
210-
If your release belongs to a fork you can use [aliasing](https://docs.npmjs.com/cli/v8/commands/npm-install)
211-
to point to the release of the package in the npm repository for the fork:
212-
213-
```shell
214-
npm config set @my-fork:registry=https://npm.pkg.github.com
215-
npm install @danskernesdigitalebibliotek/dpl-design-system@npm:@my-fork/dpl-design-system@feature-reservation-modal
216-
```
217-
218-
This will update your `package.json` and lock files accordingly. Note that
219-
branch releases use temporary versions in the format `0.0.0-[GIT-SHA]` and you
220-
may in practice see these referenced in both files.
221-
222-
If you push new code to the branch you have to update the version used in the
223-
consuming project:
224-
225-
```shell
226-
npm update @danskernesdigitalebibliotek/dpl-design-system
227-
```
228-
229-
[Aliasing](https://classic.yarnpkg.com/lang/en/docs/cli/add/#toc-yarn-add-alias),
230-
[repository configuration](https://classic.yarnpkg.com/en/docs/cli/config) and
231-
[updating installed packages](https://classic.yarnpkg.com/en/docs/cli/upgrade)
232-
are also supported by Yarn.
233-
234-
#### Usage: Release file
235-
236-
Find the release for the branch on [the releases page on GitHub](https://github.com/danskernesdigitalebibliotek/dpl-design-system/releases)
237-
and download the `dist.zip` file from there and use it as needed in the
238-
consuming project.
239-
240-
If your branch belongs to a fork then you can find the release on the releases
241-
page for the fork.
242-
243-
Repeat the process if you push new code to the branch.
244-
245-
## Storybook
246-
247-
Spin up storybook by running this command in the terminal:
248-
249-
```shell
250-
yarn storybook
251-
```
252-
253-
When storybook is ready it automatically opens up in a browser with the
254-
interface ready to use.
255-
256-
## Chromatic
257-
258-
We are using Chromatic for visual test. You can access the dashboard
259-
under the `danskernesdigitalebibliotek` (organisation) `dpl-design-system`
260-
(project).
261-
262-
<https://www.chromatic.com/builds?appId=616ffdab9acbf5003ad5fd2b>
263-
264-
You can deploy a version locally to Chromatic by running:
265-
266-
```shell
267-
yarn chromatic
268-
```
269-
270-
Make sure to set the `CHROMATIC_PROJECT_TOKEN` environment variable is available
271-
in your shell context. You can access the token from:
272-
273-
<https://www.chromatic.com/manage?appId=616ffdab9acbf5003ad5fd2b&view=configure>
274-
275-
### What is Storybook
276-
277-
[Storybook](https://storybook.js.org/docs/react/get-started/introduction) is an
278-
open source tool for building UI components and pages in isolation from your
279-
app's business logic, data, and context. Storybook helps you document components
280-
for reuse and automatically visually test your components to prevent bugs. It
281-
promotes the [component-driven](https://componentdriven.org) process and agile
282-
development.
283-
284-
It is possible to extend Storybook with an ecosystem of addons that help you do
285-
things like fine-tune responsive layouts or verify accessibility.
286-
287-
#### How to use
288-
289-
The Storybook interface is simple and intuitive to use. Browse the project's
290-
stories now by navigating to them in the sidebar.
291-
292-
The stories are placed in a flat structure, where developers should not spend
293-
time thinking of structure, since we want to keep all parts of the system under
294-
a heading called Library. This Library is then dividid in folders where common
295-
parts are kept together.
296-
297-
To expose to the user how we think these parts stitch together for example
298-
for the new website, we have a heading called Blocks, to resemble what cms
299-
blocks a user can expect to find when building pages in the choosen CMS.
300-
301-
This could replicate in to mobile applications, newsletters etc. all pulling
302-
parts from the Library.
303-
304-
Each story has a corresponding `.stories` file. View their code in the
305-
`src/stories` directory to learn how they work.
306-
The `stories` file is used to add the component to the Storybook interface via
307-
the title. Start the title with "Library" or "Blocks" and use / to
308-
divide into folders fx. `Library / Buttons / Button`
309-
310-
#### Addons
311-
312-
Storybook ships with some essential
313-
pre-installed [addons](https://storybook.js.org/addons/tag/essentials/)
314-
to power the core Storybook experience.
315-
316-
- [Controls](https://storybook.js.org/addons/@storybook/addon-controls/)
317-
- [Actions](https://storybook.js.org/addons/@storybook/addon-actions/)
318-
- [Docs](https://storybook.js.org/addons/@storybook/addon-docs/)
319-
- [Viewport](https://storybook.js.org/addons/@storybook/addon-viewport/)
320-
- [Backgrounds](https://storybook.js.org/addons/@storybook/addon-backgrounds/)
321-
- [Toolbars](https://storybook.js.org/addons/@storybook/addon-toolbars/)
322-
- [Measure](https://storybook.js.org/addons/@storybook/addon-measure/)
323-
- [Outline](https://storybook.js.org/addons/@storybook/addon-outline/)
324-
325-
There are many other helpful addons to customise the usage and experience.
326-
Additional addons used for this project:
327-
328-
- [HTML / storybook-addon-html](https://storybook.js.org/addons/@whitespace/storybook-addon-html/):
329-
This addon is used to display compiled HTML markup for each story and make it
330-
easier for developers to grab the code. Because we are developing with React,
331-
it is necessary to be able to show the HTML markup with the css-classes to
332-
make it easier for other developers that will implement it in the future.
333-
If a story has controls the HTML markup changes according to the controls that
334-
are set.
335-
336-
- [Designs / storybook-addon-designs](https://storybook.js.org/addons/storybook-addon-designs/):
337-
This addon is used to embed Figma in the addon panel for a better
338-
design-development workflow.
339-
340-
- [A11Y](https://storybook.js.org/addons/@storybook/addon-a11y/):
341-
This addon is used to check the accessibility of the components.
342-
343-
All the addons can be found in `storybook/main.js` directory.
344-
345-
#### Important to notice
346-
347-
##### Internal classes
13+
The codebase follows the naming that designers have used in Figma closely to
14+
ensure consistency.
34815

349-
To display some components (fx Colors, Spacing) in a more presentable way, we
350-
are using some "internal" css-classes which can be found in the
351-
`styles/internal.scss` file. All css-classes with "internal" in the front should
352-
therefore be ignored in the HTML markup.
16+
Read more about the DPL Design System by visiting our
17+
[Documentation site](https://danskernesdigitalebibliotek.github.io/dpl-docs)

0 commit comments

Comments
 (0)