Coder Social home page Coder Social logo

nl-design-system / denhaag Goto Github PK

View Code? Open in Web Editor NEW
12.0 8.0 7.0 71.09 MB

Work in Progress: Den Haag Design System based on the NL Design System architecture

Home Page: https://nl-design-system.github.io/denhaag/

License: Other

JavaScript 1.92% TypeScript 30.43% SCSS 16.51% MDX 51.01% HTML 0.13%
react component-library nl-design-system storybook

denhaag's Introduction

@gemeente-denhaag/components-react

A library of React components for the municipality of The Hague

npm GitHub Workflow Status (branch)

🥅 Goals of this codebase

The Municipality of The Hague React UI-components library is constructed, so that re-use by other government organisations is possible with minimal effort. The UI-components are available in a basic styling and through the use of Design Tokens it is possible to give the components your own (corporate) identity. Within the Municipality of The Hague the components are used for:

  • Corporate website (Wordpress - Open Web Concept)
  • Satelite websites (Wordpress)
  • OpenSource eForms (OpenFormulieren - Dimpact)
  • Portal (MijnDenHaag - collaboration with Amsterdam and Dimpact)

🚀 Getting started

Install component library

npm install @gemeente-denhaag/components-react

Usage

import React, { Component } from "react";

import { MyComponent } from "@gemeente-denhaag/components-react";

class Example extends Component {
  render() {
    return <MyComponent />;
  }
}

Develop

Setting up the development environment

  1. Clone this repository
  2. Install npm go here for instructions. Make sure to install version 16.13.0 or higher.
  3. Install pnpm using these instructions.
  4. Run the following command to install all development dependencies:
pnpm install --frozen-lockfile

Code style

Be sure to install IDE plugins for ESlint, Prettier, JSONLint and Stylelint if available.

Folder structure

The project folders are structured in the following way: The src folder houses both our components and our storybook stories, these are both in their own folders. Our components are sorted into several categories, where each category has its own parent folder. All of our components are their own package and managed with lerna, docs are available here. Similarly, each category is its own package managed with lerna.

Adding components

Storybook

In order to test components we use storybook.\

If you have not yet run build then please run the build. If you already have run this command then skip this next command:

pnpm run build

To run storybook locally we start it with the following command:

pnpm run storybook

We don't need to re-run the command over-and-over because storybook should detect changed files ✨automagically✨ and refresh the displayed components.

Creating a new package for a new component

In order to create a new lerna package we need to create a package.json file for it inside it's folder. Start by filling it with the following information:

{
  "name": "@gemeente-denhaag/{component_name}",
  "version": "0.1.0",
  "description": "A short description of the component",
  "bugs": "https://github.com/nl-design-system/denhaag/issues",
  "author": "Municipality of The Hague",
  "license": "EUPL-1.2",
  "exports": {
    ".": {
      "types": "./dist/cjs/index.d.ts",
      "import": "./dist/mjs/index.js",
      "default": "./dist/cjs/index.js"
    },
    "./index.css": "./dist/index.css"
  },
  "main": "dist/cjs/index.js",
  "module": "dist/mjs/index.js",
  "types": "dist/cjs/index.d.ts",
  "files": ["dist"],
  "repository": {
    "type": "git",
    "url": "https://github.com/nl-design-system/denhaag.git",
    "directory": "{path/to/component}"
  },
  "scripts": {
    "build": "rollup -c ../../rollup.config.mjs",
    "clean": "rimraf dist tsconfig.tsbuildinfo"
  },
  "dependencies": {}
}

Don't forget to add all needed dependencies for your component to the dependencies section of the component's package.json.

We will also need to add our component to the meta-package which installs all of the Den Haag react components in the same category. We can do this by adding it to the list of dependencies. The file we need is located here: components/[CATEGORY]/package.json
An entry should be structured like this:

"@gemeente-denhaag/{component_name}": "workspace:*"

Similarly, if you create a new category we need to add the category package to the list of dependencies in the meta-package which installs all of the Den Haag react components. This file is located here: components/package.json

An entry should be structured in the same way as above.

Test component in CSP environment

With Express we created an CSP environment to test our components in. This is a local environment that can be used to test our components in a environment with CSP headers in place. To start the CSP environment run the following command:

node server.js

Cooperation with NL Design System

Certain Components available in this repository may become part of the NL Design System component library. When you contribute to this project you allow your contributions to be made a part of the NL Design System component library. The NL Design System project maintainers decide which components will be included in their component library.

❗ Reporting issues

Our public issue tracker is located here. Before reporting an issue make sure to check if a similar issue already exists. When reporting an issue give detailed information about the issue and how to reproduce it if applicable.

Special thanks

Chromatic supports us with a free starter plan for open source.

denhaag's People

Contributors

alikdhim87 avatar bddjong avatar borai avatar danielvanvliet avatar dependabot[bot] avatar dutchcelt avatar gewoonmaarten avatar goedideemedia avatar jeroenlives avatar joostfroon avatar joostvanviegen avatar koenbrouwer avatar marwaxhello avatar matijs avatar mcarsjensgx avatar meesopost avatar mjcarsjens avatar nl-design-system-ci avatar ogjtech avatar paulacato avatar robbert avatar robbieatacato avatar ryanvvalkenhoef avatar savitris avatar scar055 avatar test-automation-engineer avatar usethetics avatar yolijn avatar yourivhdenhaag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

denhaag's Issues

Incorrect props for MenuItem

The MenuItem components has fields missing in the MenuItemProps.

In the Select story, MenuItem is imported from Material UI and not the component Library. This (likely) resulted in an incorrect Props for MenuItem since the 'value' field is missing.

Tasks

  • MenuItem Props 'value' field added
  • In the Select story in storybook, the MenuItem from is imported from the nlds-react-component library (instead of MUI)

Add documentation for all list related components

Currently there is no documentation in Storybook for:

  • ListItem
  • ListItemAvatar
  • ListItemIcon
  • ListItemSecondaryAction
  • ListItemText
  • ListSubheader

I had to look at the source code to learn how to use these components.

Design: Subnavigation

The Subnavigation needs to be styled according to the Figma design.

Acceptance criteria

Pagination Item variants implemented

  • Base
  • Active

Pagination Item states implemented

  • Normal
  • Hover
  • Focus
  • Disabled

Requirements

  • On mobile a sticky header is visible, which shows the subnavigation in a Drawer when clicked (and possibly more (?))
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

ListItem props use wrong type

Some properties of the ListItem use the wrong type. For example the button prop has type false which should be boolean.

Also check the other components if they have this issue.

Design: Text field

The TextField component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Single line
  • Multi line

States implemented

  • Normal
  • Hover
  • Disabled
  • Error
  • Focus

Components

  • Optional placeholder text
  • Optional helper text
  • Required label
  • Optional error text
  • For the multi-line variant an optional character counter can be added

Icon support

  • An optional trailing icon can be added in the text filed
  • An optional error icon can be added in the text field (when a trailing icon is shown, the error icon will appear before it)

For this we have to use the MUI InputAdornment component

Requirements

  • The optional character counter should be supplied a max-length and update the current amount of characters when typing.
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Missing component: Link

The Link component has not been wrapped.

Expose the following API properties

  • children
  • classes
  • underline
  • TypographyClasses

Acceptance criteria

  • Specified API properties are exposed
  • A Storybook story displays the component and it's API

Design: Menu buttons

The Menu Button component needs to be styled according to the Figma design.

As a base for this we will use the Material-UI Link and PopOver components instead of the Material-UI Menu component.

This will result in two components, one Menu component in which multiple Menu Button components can exist.

Acceptance criteria

Variants implemented

  • With options
  • Without options

States implemented

  • Normal
  • Hover
  • Focus
  • Active

Animations
Animations are out of scope at this point.

Dropdown
As the dropdown design is not yet complete the dropdown styling will be performed in another issue once the design is finished.

Requirements

  • Without options variant is represented by a HTML <a> component
  • The dropdown version is represented by a HTML <button> component
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.
  • Storybook shows HTML code snippet (with classes and accessibility suggestions) (Depends on #267 )

Design: List

The List and List related components needs to be styled according to the Figma design.

Acceptance criteria

Components

  • List

  • ListItem

  • ListItemIcon

  • ListItemText

  • ListSubHeader

  • ListItemSecondaryAction

ListItem variants implemented

  • Normal
  • With Arrow (on the right side)
  • With Action (on the right side)

ListItem sizes implemented

  • One line
  • Two lines (with subtitle ListItemText secondary attribute)

ListItem states implemented

  • Normal
  • Hover
  • Focus
  • Active

ListItem icon support (ListItemIcon)

  • Icon can provided
  • Icon can be placed on the left side

Material-UI Components which we do not use

  • ListItemAvatar

ListSubHeader variants implemented

  • Normal

List variants implemented

  • Normal

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Drawer

The Drawer component needs to be styled according to the Figma design.

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Badges

The Badge component needs to be styled according to the Figma design.

Acceptance criteria

Components implemented

  • Badge with number (uses a dot badge internally)
  • Dot badge

Requirements

  • The badge should only be visible when the count is larger than 1
  • When the count is larger than 999 it should display 999+ in the Badge with number variant
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Code snippet showing HTML structure with BEM classes in storybook
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Wrap Skeleton, Alert, Pagination, Timeline MUI components

[S] = Small, [M] = Medium, [L] = Large, [O] = Optional

A component is finished when:

  • documentation is ready in storybook

  • all variants are in storybook

  • All parameters are documented (briefly, expand after basic styling)

  • where applicable, actions linked to components

  • versioning added to component (must be below 1.0)

  • package defined and added to meta package within Lerna

  • review by a colleague after the above tasks are complete before going to Master

  • code has been merged to master

  • component visible on Storybook production (then subtask on Done)

Applicable after adding Basic Design

  • component has been tested functionally

  • unit test (discuss with @mjcarsjens)

  • accessibility check guide has been completed

Tasks

  • [L] Skeleton
  • [M, O] Alert
  • [M] Pagination
  • Timeline

Fix linters

Some problems with the linters:

  • Currently prettier overwrites standardjs.
  • Stories cannot be linted because they have been added to tsconfig.json. It leads to a weird error when you try to lint all .ts and .tsx files:
    Parsing error: "parserOptions.project" has been set for @type script-eslint/parser
  • eslint is still in the project despite us not using it anymore.

CSS Solution and Design Tokens

Investigative issue about the cooperation between design tokens and CSS variables.

Our goal for this issue is to perform a PoC on how these two correspond to each other and how to handle styling in our React components.

For this PoC we compile a shortlist of design tokens from which we choose 3, which we will apply to several (?) components.

Our documentation will be updated with our findings from this PoC.

NOTE: The PoC will not be merged to master as it is purely a PoC!

  • Correspondence with NLDS about Design Tokens
  • Investigation into CSS variables
  • Create a design token shortlist and choose 3 design tokens and several components for our PoC
  • Perform PoC
  • Update documentation with findings from the PoC

Design: Navigation links

The Navigation Link component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Text only
  • Icon left
  • Icon right

States implemented

  • Normal
  • Hover
  • Disabled
  • Focus

Requirements

  • Icon is placed as a prop not in the children
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Modal

The Modal component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Base

Required parts

  • Title
  • Close Icon
  • Text

Button support

  • Optional Primary Action Button
  • Optional Secondary Action Button

Requirements

  • The Modal should overlay the content
  • No interaction should be possible outside the Modal until it is closed
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Tag

The Tag component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Red
  • Orange
  • Green
  • Blue
  • Grey

Note: the names of these variants should be discussed. Using colors in the variant names is something we should not do, these should be named by their use not by their visual appearance (e.g. Error, Warning etc.).

Requirements

  • Support for aria-label HTML prop
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Missing Component: ListItemIcon

In order to display icons in Lists, Select and other MUI based components we will need the ListItemIcon component.
It is usually used within a ListItem, or a MenuItem.

This issue is related to #19 since both are a result of using MUI components within stories, instead of only using nlds-react components.

Tasks

  • Add a new wrapped ListItemIcon component, in the correct hierarchy/folder
  • Updated stories that are using ListItemIcon from MUI to use our wrapped ListItemIcon
  • Add new/update story that uses the ListItemIcon within one or more components: List, Select, Menu

Design: Toggle

The Switch component (called Toggle in the design) needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Inactive
  • Active

States implemented

  • Normal
  • Hover
  • Disabled
  • Focus

Requirements

  • A label can be shown above the toggle
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Radio Button

Style the radio and radio group according to Figma design.

The Radio (and RadioGroup) component needs to be styled according to the Figma design.

Note: all requirements are equal to the ones on Checkbox and Checkbox Group

Acceptance criteria

Variants implemented

  • Active
  • Inactive

States implemented

  • Normal
  • Hover
  • Disabled
  • Error
  • Focus

RadioGroup

  • Each radio group can have a header label
  • Each radio group can have a help text
  • Each radio group can have an error text which should appear in conjunction with all checkboxes in the group having the Error state

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Add an Icons Package

Currently we have no ideal solution for using Icons in the PWA.
One approach we use is to generate a React component from an svg.
This does not integrate with our other MUI-based components as nicely as it could.

MUI uses the SvgIcon component to create its icons. Using this in the PWA requires a dependency on MUI core and is not recommended.

If we expose an Icon package in the component library that uses SvgIcon internally we avoid alot of styling problems

Tasks

  • Add an icons package
  • Wrap the SvgIcon component
  • For each icon in the design system, create an Icon Component.
  • Storybook stories to demonstrate how to use the icons (show all icons in one story/page)

Acceptance criteria

  • Components use SvgIcon
  • SvgIcon component can be used separately
  • All icons from the PWA prototype are supported

Design: Checkbox

The Checkbox component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Active
  • Inactive

States implemented

  • Normal
  • Hover
  • Disabled
  • Error
  • Focus

CheckboxGroup (FormGroup Component)

  • Each checkbox group can have a header label
  • Each checkbox group can have a help text
  • Each checkbox group can have an error text which should appear in conjunction with all checkboxes in the group having the Error state (which replaces the help text)

Requirements

  • Checkmark provided as SvgIcon, not default MaterialUI checkmark
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.
  • Storybook shows HTML code snippet (with classes and accessibility suggestions) (Depends on #267 )

Design: Alerts

The Alert component needs to be styled according to the Figma design.
For the implementation we will not be using a Material-UI component, instead we will use our own HTML implementation together with our already existing components. For this we will use the stencil component provided below as inspiration.

The accessibility side of the implementation should be researched and carefully tested.

Acceptance criteria

Variants implemented

  • Base
  • Alert
  • Info
  • Success
  • Warning

Button support

  • Optional close button
  • Optional action button

Icon support

  • Icon can be provided

Animations
For now we will deliver this component without animations. Animations will be added at a later date.

Requirements

  • Size of the Alert is based on the context it is placed in
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.
  • Storybook shows HTML code snippet (with classes and accessibility suggestions) (Depends on #267)

StoryBook documentation is broken

Some components like Menu and AppBar break the documentation page in storybook. The component is overlayed on the documentation and you are unable to view it. Also the scrollbar disappears.

image
See https://nldsreactstorybook.azurewebsites.net/?path=/docs/components-navigation-menu--default.

  • Menu no longer has an overlay on the documentation page
  • AppBar no longer has an overlay on the documentation page
  • Drawer no longer has an overlay on the documentation page
  • SwipeableDrawer no longer has an overlay on the documentation page
  • Check other components in storybook for broken documentation (and create new issues if needed)

Move backlog from Jira to Github

Met de aankomende overstap van Azure Repos naar GitHub zal er op GitHub in de nieuwe Repos een stukje basisinrichting gedaan moeten worden.

Hierbij gaat het om de volgende zaken:

  • Intern uitzoeken of mag vanuit gemeente (Vincent)
  • Naam bepalen
  • Github repos aanmaken
  • Repo's importeren
  • CI/CD met automatisch deployen naar Storybook environments (huidige of nieuwe in Git? Menno uitzoeken)
  • Dependabot inrichten
  • Git Hook die een yarn install runt na een pull
  • Backlog overzetten naar GitHub Projects

As a maintainer, I want a CLA and CLA bot to guarantee the open source license

  • CLA.md file (Contributor License Agreement) in the repository that must be signed to submit a pull request.

  • Robbert Broersma (NLDS) in Slack, about their own POC repository: Now when you contribute code via GitHub, you will automatically be asked to sign a Contributor License Agreement (CLA), so that the open source license is guaranteed for all code in the brand new Git repository. In any case, we have to set up that CLA bot for all repositories in the nl-design-system organization, so that the open source license is guaranteed. That is something I can help with.

Tasks

  • Adopt NLDS CLA en modify for our project
  • Discuss with Jantien Hoving
  • CLA bot requires signed CLA before merging a pull request

Design: Divider

The Divider component needs to be styled according to the Figma design design.

Acceptance criteria

Variants implemented

  • Horizontal
  • Vertical

Requirements

  • Width is always the full width of the container
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Make component library available for other projects

To enable developers to use our component library, it must be published on an NPM registry.

This is also necessary for us to use the library in the PWA. We may want to initially publish the library on a private registry, but in the context of transparency and open-source it seems better to do this directly on NPM.

Acceptance criteria

  • NDLS React Component Library packages are publicly available

  • Packages are scoped (just like Material does with the @Material). For example:
    @nlds-react-components
    @nlds-react-components/input
    @nlds-react-components/layout
    @nlds-react-components/navigation
    @nlds-react-components/surfaces

  • The scope name has been determined in consultation with the Team (and possibly NLDS)

  • The process of publishing new versions is clearly documented.

    • Is this automatic or is it done manually by maintainers?

Tasks

  • Package scope name has been determined
  • Component library can be used by 3rd party (decide how to do this)
  • Research publish workflow
  • Component library is available in NPM and can be used as a dependency in other projects

Fix installation files for components.

Currently, component's .tsx files are provided as is, meaning that the developer who installs the components gets the raw .tsx files. Usually you want to transpile the ts to js and provide a Typescript type file and/or transpile esx to es2017, which 90% of the browser support. This way developers can use both Javascript and Typescript.

TODO:

According to web.dev the following package structure is desired when publishing a package. modern.js and module.js are es2017, while legacy.cjs is es5.

{
  "name": "foo",
  "exports": "./modern.js",
  "main": "./legacy.cjs",
  "module": "./module.js"
}

Tasks

  • Research what files we want to provide to the user of the component
  • Fix the package such that these files are include in the package.
  • Test if the package is correctly installed.
  • the microbundle-crl bundler does not install the Typescript types in the correct place (dist/src instead of dist).
  • components use react in their code, but don't have a dependency in their package.json. Add react as peer dependency.

Check storybook stories for incorrect MUI imports

Currently, several storybook stories are importing components from MUI Core instead of our own components. For example; Divider and List. The purpose of this story is to check the stories files for incorrect imports, and documenting them so that follow-up actions can be taken.

If a component is imported from MUI even though it's in the component library, the import can be fixed straight away. If a new component needs to be wrapped to fix the import, document it so that we can evaluate whether or not we want to wrap it.

Acceptance criteria

  • All stories files are checked for incorrect imports
  • Components that need fixing are documented and fixed if possible

Design: Select

The Select component needs to be styled according to the Figma design.

Acceptance criteria

States implemented

  • Normal
  • Active
  • Disabled
  • Error
  • Focus

Options
For the options default browser options are used. (native prop)
Requirements

  • When no value is selected a optional placeholder text can be show, otherwise the selected value.
  • For the disabled Select no placeholder will be shown.
  • On error an optional error icon can be shown.
  • A label has to always be shown above a Select.
  • An optional helper text can be shown below a Select.
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Pagination

The Pagination component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Normal
  • Collapsed
  • Icon

States implemented

  • Normal
  • Hover
  • Focus
  • Active

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Design: Form navigation

The Form Navigation component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Desktop: Same as Stepper but with added Error option
  • Mobile: Same stickied header as with the Anchor Navigation, but in the Drawer the Desktop version of this component

States implemented

  • Hover
  • Error

Note: What about a focus state?

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Restructure directories and packages

Currently, if you install the root package you'll get all components three times. This is because of the nested package structure we currently have. This is not desirable. In addition, component's .tsx files are provided as is, meaning that the developer who installs the components gets the raw .tsx files. Usually you want to transpile the ts to js and provide a Typescript type file and/or transpile esx to es2017, which 90% of the browser support. This way developers can use both Javascript and Typescript.

Tasks:

  • Flatten the directory structure such that every component is directly in the src/components directory. The group components like surfaces and input can be moved to src/groups (for example) for clarity as their only purpose is to group components.
  • consolidate some components into one package as it makes little sense to use one without the other:
    • Components into tab
      • tab
      • tabcontext
      • tablist
      • tabpanel
      • tabs
      • tabscrollbutton
    • Components into menu
      • menuitem
      • menulist
      • popover
      • popper
    • Components into list
      • listitem
      • listitemavatar
      • listitemicon
      • listitemsecondaryaction
      • listitemtext
      • listsubheader
    • Components into avatar
      • avatargroup
    • Components into card
      • cardactions
      • cardcontent
      • cardheader
      • paper
    • Components into accordion
      • accordionactions
      • accordiondetails
      • accordionsummary
  • Create an index.tsx files when needed.
  • Fix installed package files. TBD
  • Test if components install correctly.

Automated Versioning: take advantage of Lerna Conventional Commit

Currently, if we want to bump the version of the package we have to do this manually. Lerna supposedly (it is not documented very well) provides functionality which looks at your commit history to automatically update the packages. To make use of this our commit messages need to adhere to the Conventional Commits structure.

Sources:

Tasks

  • Test if this actually works. (If not, close this issue)
  • Configure Lerna such that it knows we use Conventional Commits.
  • Install a linter to check if we adhere to Conventional Commits.

Storybook's 'show code' option displays incorrect code

When navigating the docs of a story on nldsreactstorybook, the 'show code' option does not always show working code.

For instance, in the Appbar docs:
show-not-working

The actual story for Appbar looks like this:

return (
    <AppBar {...args}>
      <Toolbar>
        <IconButton
          edge='start'
          className={classes.menuButton}
          color='inherit'
          aria-label='menu'
        >
          <MenuIcon />
        </IconButton>
        <Typography variant='h6'>News</Typography>
      </Toolbar>
      <Button>I am a button!</Button>
    </AppBar>
  )

I would expect at least working code, all of which should be in the nlds-react-components library (WithStyle is Material UI).

  • Investigate how to customize the code example without creating an entire .MD file.
  • Check all component stories to make sure Show code shows working code. Compile a list of all stories that have broken code examples so that follow-up issues can be made.
  • Follow-up issues have been made

Design: Anchor navigation (desktop)

TODO: Look at how to actually build this one.

The Anchor Navigation component needs to be styled according to the Figma design.

Acceptance criteria

Variants implemented

  • Default

States implemented

  • Normal
  • Hover
  • Focus
  • Active

Requirements

  • The Anchor navigation should we stickied on desktop
  • The left bar should should indicate the scroll depth on the page
  • The heading above the current content on screen should be active
  • Max 2 lines of text can be shown for the labels
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Out of scope:

  • On mobile it should sticky in the header once scrolled past it as indicated by the design
  • On mobile clicking the stickied header should open a Drawer containing the full anchor navigation

Missing Component: InputAdornment

In order to display icons within a Textfield, we will need the InputAdornment component.

Tasks

  • Added the InputAdornment component
  • Added a story with the InputAdornmentComponent in a TextField component (Both imported from nlds-react-components)

Add storybook-static to .prettierignore

Prettier will run on the storybook-static directory, but this is not intended.

Tasks:

  • Add storybook-static to .prettierignore
  • Check if other directories need adding.

Button component should expose type property in the API

The button component currently does not allow the user to add a type='submit' property when implementing the component. This throws a 'type does not exist' error in typescript. This easiest way to resolve this is by exposing the property in our API. An alternative solution is using the same generic extending syntax as Material UI uses in their button type definition

Acceptance criteria

  • Button supports the type='submit' property when implementing it in an external project

Add README.md to every component

Currently, none of the components have a README.md file. When you go to the published package site you don't get any useful information about the component. I suggest creating at least a basic README with a link to the correct Storybook page.

Tasks:

  • Install markdownlint, like nl-design-system. Add it to lint-staged.
  • Develop a README template which can be used for all components.
    • Link to the component in Storybook
    • Description of component
    • Use cases for component
  • Add this template to every component

Design: Button

The button component needs to be styled according to the Figma design.

The button has been largely styled in the Design Token POC.

Animations are out of scope!

Write down instructions/checklist in the wiki

Acceptance criteria

Variants implemented

  • Primary action (filled background)
  • Secondary action (outline)

Sizes implemented

  • Large size
  • Medium size

States implemented

  • Normal
  • Hover
  • Disabled
  • Focus

Icon support

  • Icon can provided
  • Icon can be placed on the left side
  • Icon can be placed on the right side

Requirements

  • Width varies depending on the length of the text
  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

Going public with components repo

Before we can go public we will need to take care of and / or check the following things. These things need to be in the master branch before going public:

  • The LICENSE file contains the EUPL v1.2 and copyright statement
  • The goal of the codebase has been documented:, what do we hope to achieve with the code see here
  • There is a link to our public issue tracker from the README file
  • The repository contains an up-to date CONTRIBUTING file with information on how to contribute to the codebase
  • The repository has been renamed to denhaag-component-library
  • Add information about contributions which will be included in nlds to README and CONTRIBUTING
  • Remove all packages from Github packages
  • Publish all packages to NPM registry (give @GewoonMaarten your npm username so he can add you)
  • Align package versions. Some packages have a different version number.

Design: Breadcrumbs

The Breadcrumbs component needs to be styled according to the Figma design.

Acceptance criteria

Uses links followed by arrows.

Variants implemented

  • Normal
  • Collapsed
  • Icon

States implemented

  • Normal
  • Hover
  • Focus
  • Active

Requirements

  • Alignment requirements are met
  • Classes use the BEM naming convention
  • Design tokens are identified > proposed > implemented
  • Only the props and possible values for these props which are necessary in our use-case are exposed. All other Material-UI and standard HTML props which are not deemed necessary in our use-case should not be allowed/forwarded to the underlying component.

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.