To install you will need Node 18 on your computer locally: https://nodejs.org/en/download (Select LTS)
Once that's installed, you will need to install yarn which you can do by running
npm install --global yarnClone this repo and cd idx-design-system
Following the initial clone, run:
yarnRunning this is the same as yarn install and will install all the required dependencies.
From there, you should be able to run:
yarn workspace @idx/styleguide devFrom there you will them have the styleguide running at http://localhost:3000
echo "NEXT_IMAGE_DOMAIN=v2-develop.docksal.site" > .envThere are a few global commands worth mentioning:
To run jest you can use:
yarn testadding the --watch flag will watch new and amended tests in the background.
If you are wishing to check coverage it's possible to that with the flags --coverage --collectCoverageFrom="./packages/idx-design-system/**{.ts,.tsx}"
To ensure that the codebase is meeting the best practices, we can run it through ESLint.
yarn lintCode formatting can automatically be applied with Prettier. You can run this by using the following command:
yarn formatTo run all of these commands at once, there is the following command which can be run:
yarn mac-daddyAll of the Next.js command are available to see here. The ones used commonly on this codebase are:
Runs the node.js development server
yarn workspace {STARTER} devBuilds the codebase into a production ready version fo the site.
yarn workspace {STARTER_NAME} buildRuns an express server using the files built in the above command
yarn workspace {STARTER} serveThe codebase is using the following tools:
- Next.js - React meta-framework provides the frontends
- Typescript β Compiles project with type safety
- Theme UI β CSS-in-JS styling library based on Emotion and uses the System UI theme spec.
- Jest β JS unit testing tool
- ESlint β code linter
- Prettier - code formatter
- Lerna & Yarn workspaces β Manages releases and versioning for monorepo
- Next-Drupal - connects Drupal with Next.js
βββ packages
βΒ Β βββ idx-design-system
βΒ Β βΒ Β βββ base
βΒ Β βΒ Β βΒ Β βββ atoms
βΒ Β βΒ Β βΒ Β βΒ Β βββ colour
βΒ Β βΒ Β βΒ Β βΒ Β βββ grid
βΒ Β βΒ Β βΒ Β βΒ Β βββ icons
βΒ Β βΒ Β βΒ Β βΒ Β βββ pictograms
βΒ Β βΒ Β βΒ Β βΒ Β βββ radius
βΒ Β βΒ Β βΒ Β βΒ Β βββ shadows
βΒ Β βΒ Β βΒ Β βΒ Β βββ spacing
βΒ Β βΒ Β βΒ Β βΒ Β βββ typography
βΒ Β βΒ Β βΒ Β βββ molecules
βΒ Β βΒ Β βΒ Β βββ accordions
βΒ Β βΒ Β βΒ Β βββ buttons
βΒ Β βΒ Β βΒ Β βββ category-tags
βΒ Β βΒ Β βΒ Β βββ logo
βΒ Β βΒ Β βΒ Β βββ navigation-collection
βΒ Β βΒ Β βΒ Β βββ navigation-items
βΒ Β βΒ Β βΒ Β βββ pagination-arrows
βΒ Β βΒ Β βΒ Β βββ text-links
βΒ Β βΒ Β βββ components
βΒ Β βΒ Β βΒ Β βββ footers
βΒ Β βΒ Β βΒ Β βββ globals
βΒ Β βΒ Β βΒ Β βββ headers
βΒ Β βΒ Β βββ lib
βΒ Β βΒ Β βββ theme
βΒ Β βββ idx-next-drupal-connector
βΒ Β βββ components
βΒ Β βΒ Β βββ content-types
βΒ Β βββ lib
βββ starters
βΒ Β βββ create-idx-next-drupal-app
βΒ Β βΒ Β βββ pages
βΒ Β βΒ Β βΒ Β βββ api
βΒ Β βΒ Β βΒ Β βββ styleguide
βΒ Β βΒ Β βββ variations
βΒ Β βΒ Β βββ components
βΒ Β βΒ Β βΒ Β βββ globals
βΒ Β βΒ Β βΒ Β βββ headers
βΒ Β βΒ Β βββ styles
βΒ Β βββ styleguide
βΒ Β βββ components
βΒ Β βΒ Β βββ section
βΒ Β βββ pages
βΒ Β βΒ Β βββ atoms
βΒ Β βΒ Β βββ molecules
βΒ Β βββ variations
βββ test
βββ types
Packages are isolated portions of code that can be installed indiviudally depending on the context.
Currently, this is the most important package and is building the various React components for the IDX Design System. It's based on the following Figma file which has been created by the design team and it is loosely following the Atomic Design principles.
The structure of the codebase has been built to mirror a closely as possible the structure in the Figma file.
.
βββ base
βΒ Β βββ atoms
βΒ Β βββ molecules
βββ components
βΒ Β βββ globals
βΒ Β βββ ...
βββ lib
βββ pages
βΒ Β βββ results-presentations
βΒ Β βββ ...
βββ theme
lib β stores global utility functions such as getting the current path
theme β This is the main ThemeUI JSON Object which is combining all of the component styles together.
When creating a new component in the IDX Design System package the following structure should be followed:
.
βββ __tests__
βΒ Β βββ __snapshots__
βΒ Β βΒ Β βββ {COMPONENT_NAME}.test.tsx.snap
βΒ Β βββ {COMPONENT_NAME}.test.tsx
βββ styles
βΒ Β βββ {COMPONENT_NAME}.ts
βββ {COMPONENT_NAME}.tsx
βββ utils
βββ __tests__
βΒ Β βββ __snapshots__
βΒ Β βΒ Β βββ {COMPONENT_NAME}.test.ts.snap
βΒ Β βββ {COMPONENT_NAME}.test.ts
βββ {COMPONENT_NAME}.ts
{COMPONENT_NAME}.tsx β Required the main component to be imported.
utils β any helper utilities that are required.
styles β Theme UI style configurations to be added to the main theme/theme.ts file.
__tests__ β Jest assertions go here if utils or styles require additional tests then they should also contain a __tests__ directory.
{COMPONENT_NAME}.test.tsx β The file containing the Jest tests.
__tests__/__snapshots__ β This is an automatically generated file which contains any Jest snapshots that have been created in the {COMPONENT_NAME}.test.tsx.snap file.
This is very much a WIP and is using the Next-Drupal package to link content types to a Drupal instance.
A WIP demo to show the the connection between a Drupal and Next instance. To be converted into a create-{package_name}-app recipe.
Displays the different options available in a theme-able manner.