Skip to content

Commit

Permalink
Merge pull request #82 from danskernesdigitalebibliotek/release/2
Browse files Browse the repository at this point in the history
Release 2 - PR
  • Loading branch information
cableman authored Jul 5, 2022
2 parents 923e885 + 4b5d2bf commit 323c865
Show file tree
Hide file tree
Showing 50 changed files with 851 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/a11y.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'
- run: npm ci

- name: Compile styles
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'

- run: npm ci

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'
- run: npm ci

- name: Building
Expand Down Expand Up @@ -41,9 +41,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'
registry-url: "https://npm.pkg.github.com"
scope: "@${{ github.repository_owner }}"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'

- name: Cache dependencies
uses: actions/cache@v2
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'
- run: npm ci

- name: Run stylelint
Expand All @@ -29,9 +29,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'
- run: npm ci

- name: Run eslint
Expand All @@ -41,9 +41,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'

- run: npm ci

Expand All @@ -54,9 +54,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: "16"
node-version-file: '.nvmrc'

- run: npm ci

Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore markdown since linter uses other rules than Prettier
*.md

# Ignore Yaml since linter uses other rules than Prettier
*.yml
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ styles and icons.
You can find the HTML output for a given story under the HTML tab inside
storybook.

### NPM package

[The GitHub NPM package registry requires authentication if you are to access
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).

Consequently, if you want to use the design system as an NPM package or if you
use a project that depends on the design system as an NPM package you must
authenticate:

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)
2. Run `npm login --registry=https://npm.pkg.github.com`
3. Enter the following information:

```shell
> Username: [Your GitHub username]
> Password: [Your GitHub token]
> Email: [An email address used with your GitHub account]
```

Note that you will need to reauthenticate when your personal access token
expires.

## Deployment

The project is getting rebuild on pushes to every branch and every tag. In
Expand Down
10 changes: 7 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vars:
sh: git rev-list --count origin/main

# Constructing docker image name.
DOCKER_IMAGE_PREFIX: "{{ .RELEASE_IMAGE_REGISTRY }}/{{ .DOCKER_IMAGE_NAMESPACE }}"
DOCKER_IMAGE_PREFIX: '{{ .RELEASE_IMAGE_REGISTRY }}/{{ .DOCKER_IMAGE_NAMESPACE }}'

# Constructing docker image name.
RELEASE_IMAGE_NAME: '{{.RELEASE_IMAGE_NAME | default "dpl-cms-source"}}'
Expand All @@ -28,7 +28,7 @@ tasks:
summary: Install and run docker compose
cmds:
- task dev:install
- docker compose up --detach
- docker compose {{ .DOCKER_COMPOSE_FILES }} up --detach

dev:stop:
summary: Stop docker compose environment
Expand All @@ -47,10 +47,14 @@ tasks:
cmds:
- docker compose logs node --follow

dev:axe:
summary: Run accessibility tests
cmds:
- task dev:cli -- npm run storybook:axe

dev:reset:
summary: Install development environment and clean up.
cmds:
- task dev:cli -- storybook:axe
- task dev:down
- rm -rf node_modules
- task dev:up
Expand Down
5 changes: 5 additions & 0 deletions base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
@import "./src/stories/counter/counter";
@import "./src/stories/checkbox/checkbox";
@import "./src/stories/availability-label/availability-label";
@import "./src/stories/search-result-item/search-result-item";
@import "./src/stories/icon/icon-favourite/icon-favourite";
@import "./src/stories/autosuggest-text/autosuggest-text";
@import "./src/stories/button-favourite/button-favourite";
@import "./src/stories/autosuggest-material/autosuggest-material";

@import "./src/stories/list-reservation/list-reservation";
@import "./src/stories/list-dashboard/list-dashboard";
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ version: '3.7'

services:
node:
image: node:16
# Remember to keep version updated with the .nvmrc file.
# The .nvmrc file is used in Github Actions and for "dockerless" development.
image: node:16.14.2
user: node
init: true
working_dir: /home/node/app
Expand Down
26 changes: 16 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Meta } from "@storybook/react";
import React from "react";
import { withDesign } from "storybook-addon-designs";
import { StoryBaseType } from "../../../types/StorybookHelpers";

import { IconAccent as IconAccentComp } from "./ArrowAccent";

Expand Down
79 changes: 79 additions & 0 deletions src/stories/autosuggest-material/AutosuggestMaterial.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { withDesign } from "storybook-addon-designs";
import { AutosuggestMaterial, AutosuggestMaterialProps } from "./AutosuggestMaterial";

export default {
title: "Components / Autosuggest - Material",
component: AutosuggestMaterial,
decorators: [withDesign],
argTypes: {
items: {
name: "Items",
defaultValue: [
{
cover: "images/book_cover_1.jpg",
title: "De uadskillelige",
author: "Simone De Beauvoir",
year: "1954",
},{
cover: "images/book_cover_2.jpg",
title: "Den lille bog om dansk design",
author: "Marie Hugsted",
year: "2018",
},{
cover: "images/book_cover_3.jpg",
title: "Audrey Hepburn",
author: "Maria Isabel Sanchez Vegara",
year: "2018",
}
],
control: { type: "array" }
}
},
parameters: {
design: {
type: "figma",
url:
"https://www.figma.com/file/ETOZIfmgGS1HUfio57SOh7/S%C3%B8gning?node-id=4709%3A24976",
},
},
} as ComponentMeta<typeof AutosuggestMaterial>;

const Template: ComponentStory<typeof AutosuggestMaterial> = (args: AutosuggestMaterialProps) => (
// Apart from AutosuggestMaterial, everything else is here just for the story
// context. AutosuggestMaterial style is directly dependent on the header,
// search field, and AutosuggestText styling.
// If you find out this context no longer represents reality, please adjust it.
<>
<header className="header" style={{height: "144px"}}>
<div className="header__logo-desktop">
<p className="text-body-medium-regular">Context</p>
</div>
<div className="header__menu">
<nav className="header__menu-first">
<p className="text-body-medium-regular">Context</p>
</nav>
<div className="header__menu-second">
<div className="header__menu-search">
<input
className="header__menu-search-input text-body-medium-regular"
type="text"
placeholder="This field is here just for context."
/>
<img
className="header__menu-search-icon"
src={`icons/basic/icon-search.svg`}
alt="search icon"
/>
<AutosuggestMaterial {...args} />
</div>
</div>
</div>
<div className="header__clock">
<p className="text-body-medium-regular">Context</p>
</div>
</header>
</>
);

export const MaterialSuggestion = Template.bind({});
46 changes: 46 additions & 0 deletions src/stories/autosuggest-material/AutosuggestMaterial.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { Material } from "../material/Material";

export type AutosuggestMaterialProps = {
items: {
cover: string;
title: string;
author: string;
year: string;
}[]
}

export const AutosuggestMaterial = (props: AutosuggestMaterialProps) => {
const {items} = props

return (
<ul className="autosuggest pb-16">
<li>
<ul>
<li className="autosuggest__text text-body-medium-regular px-24">
I am a contextual text item
</li>
</ul>
</li>
<li className="autosuggest__divider" />
<li>
<ul className="autosuggest__materials">
{items.map((item) => {
return (
<li className="autosuggest__material">
<div className="autosuggest__material__content">
<div className="autosuggest__cover">
<Material size="xsmall" animate={true} url={item.cover} />
</div>
<div className="autosuggest__info">
<div className="text-body-medium-medium autosuggest__title">{item.title}</div>
<div className="text-body-small-regular autosuggest__author">{`${item.author} (${item.year})`}</div>
</div>
</div>
</li>
)
})}
</ul>
</li>
</ul>
)
}
Loading

0 comments on commit 323c865

Please sign in to comment.