Giter Club home page Giter Club logo

braid-design-system's Introduction

BRAID BRAID

Themeable design system for the SEEK Group.

npm


Setup

This guide is currently optimised for usage with sku, since it's configured to support Braid out of the box. If your project has a custom build setup, you'll need some extra guidance from project contributors to configure your bundler.

In your sku project, first install this library:

$ npm install --save braid-design-system

At the very top of your application, import the reset, required theme and the BraidProvider component.

WARNING: The reset styles must be imported first to avoid CSS ordering issues.

For example:

import 'braid-design-system/reset'; // <-- Must be first
import apacTheme from 'braid-design-system/themes/apac';
import { BraidProvider, Text } from 'braid-design-system';
// ...etc.

Finally, render the BraidProvider component, providing the imported theme via the theme prop:

import 'braid-design-system/reset';
import apacTheme from 'braid-design-system/themes/apac';
import { BraidProvider, Text } from 'braid-design-system';

export default () => (
  <BraidProvider theme={apacTheme}>
    <Text>Hello World!</Text>
  </BraidProvider>
);

If you're rendering within the context of another application, you may want to opt out of the provided body styles, which set the background color and reset margin and padding:

<BraidProvider theme={apacTheme} styleBody={false}>
  <Text>Hello World!</Text>
</BraidProvider>

If you'd like to customise the technical implementation of all Link and TextLink components from Braid, you can pass a custom component to the linkComponent prop on BraidProvider. For example, if you wanted to ensure that all relative links are React Router links:

import React from 'react';
import { Link as ReactRouterLink } from 'react-router-dom';
import { BraidProvider, makeLinkComponent } from 'braid-design-system';
import wireframe from 'braid-design-system/themes/wireframe';

// First create the custom link implementation:
const CustomLink = makeLinkComponent(({ href, ...restProps }, ref) =>
  href[0] === '/' ? (
    <ReactRouterLink ref={ref} to={href} {...restProps} />
  ) : (
    <a ref={ref} href={href} {...restProps} />
  ),
);

// Then pass it to BraidProvider:
export const App = () => (
  <BraidProvider theme={wireframe} linkComponent={CustomLink}>
    ...
  </BraidProvider>
);

Local Development

This project uses pnpm for development dependencies.

Installing with pnpm is required to ensure dependencies match the current pnpm-lock.yaml.

$ pnpm install
$ pnpm start

Start a local Storybook server:

$ pnpm storybook

Contributing

Refer to CONTRIBUTING.md.

Thanks

Chromatic for providing component screenshot testing, powered by Storybook.

License

MIT.

braid-design-system's People

Contributors

72636c avatar adenj avatar ashin avatar askoufis avatar benjervis avatar brad-mclean avatar brycekk avatar cm-seekasia avatar dependabot[bot] avatar etaoins avatar felixhabib avatar georgespyropoulos avatar github-actions[bot] avatar hscgavin avatar jahredhope avatar jon-chung avatar jonoc330 avatar jossmac avatar markdalgleish avatar mattcompiles avatar mengtzu avatar michaeltaranto avatar mikehdt avatar mr-beerkiss avatar mrm007 avatar patrickliu-sa avatar renovate[bot] avatar seek-oss-ci avatar tadhglewis avatar trevorgk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

braid-design-system's Issues

Stack generates a lot of extra Markup

I watched the conference talk of Mark last night and found it very interesting. One flag to me was that Stack wraps a Div for every child. Seems like an overload of unnecessary markup. The approach in our Design system was to apply a default stack (1 rem down) to our Atomic components. With a BEM modifier of $--no-stack as an optional prop noStack

If we need spacing to be grouped, we use a Block and allow that to have a variety of stack down sizes.

https://github.com/seek-oss/braid-design-system/blob/master/lib/components/Stack/Stack.tsx

Braid 29.5.0 crashes with "Cannot access 'R' before initialization"

Two of our repositories have been broken due to the upgrade from Braid 29.4.0 to 29.5.0:

  • SEEK-Jobs/indie-ryanair-frontend
  • SEEK-Jobs/indoctrinate (only the internal site)

They both use dynamic imports and appear to be crashing in what appears to be Braid's menu code. They also both work correctly when running locally using sku start.

This can be reproduced by:

  1. Checking out https://github.com/SEEK-Jobs/indoctrinate/commit/540be26abfadb88c66dbac4945537d0ad9191226
  2. Running yarn build && yarn serve
  3. Navigating to http://internal.apac.com:8080/schema

Support `react >18`

dependencies:
+ braid-design-system 32.3.0

 WARN  Issues with peer dependencies found
.
└─┬ sku 11.8.2
  └─┬ @storybook/react 6.5.16
    └─┬ react-element-to-jsx-string 14.3.4
      ├── ✕ unmet peer react@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1": found 18.2.0
      └── ✕ unmet peer react-dom@"^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1": found 18.2.0

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/preview-site.yml
.github/workflows/release.yml
.github/workflows/snapshot.yml
  • seek-oss/changesets-snapshot v0
.github/workflows/validate.yml
npm
integration/package.json
  • braid-design-system *
package.json
  • @crackle/cli ^0.15.2
  • eslint-config-seek ^13.0.0
  • renovate-config-seek 0.4.0
packages/braid-design-system/package.json
  • @capsizecss/core ^4.1.0
  • @capsizecss/metrics ^2.2.0
  • @capsizecss/vanilla-extract ^2.0.0
  • @testing-library/dom ^9.3.1
  • @testing-library/jest-dom ^6.0.0
  • @testing-library/react ^14.0.0
  • @testing-library/user-event ^14.4.3
  • playroom 0.37.1
  • sku 12.5.0
  • sku >=10.13.1
packages/codemod/package.json
packages/docs-ui/package.json
  • braid-design-system *
  • braid-design-system ^32.15.1
packages/generate-component-docs/package.json
packages/source.macro/package.json
site/package.json
  • @capsizecss/vanilla-extract ^2.0.0
  • braid-design-system *
  • playroom 0.37.1
  • sku 12.5.0

  • Check this box to trigger a request for Renovate to run again on this repository

Hidden component disrupts spacing of Stack when hidden

This is not intended as a bug report, just a continuing my line of questions while I try to educate myself on the library and theories behind it. Thanks in advance for your patience!

A hidden component creates some space in a stack unexpectedly. Is this a scenario you want to support or it doesn't really come up in the real world?

https://seek-oss.github.io/braid-design-system/playroom/#?code=N4Igxg9gJgpiBcIA8BlALgQzAawAQGcAHLGAXgB0QBzAVzTRgCdKA+cgO11yQAUAbEgAsIfWI1yCYASyqC0pYABYADAF9cAejadu-ISLETps+UrWbtXJAAkpUWJwBGMPhADuFEAA8+rAGYQEEgatvYw7Ja6AmAwwqJMRjJyCirqWhzB6FjY2iAANCBokgC2MPgIANog+DAw2ACC7ABeIAC6BW52ReXwFQDMAEzKrapAA

How is the align prop on columns supposed to work

Wondering a bit about the align prop on Columns. It doesn't seem to have an effect here:

https://seek-oss.github.io/braid-design-system/playroom/#?code=N4Igxg9gJgpiBcIA8BhCAbArgWwHYGcACAQ3QEsBzXAXgB1wZcAXGAJ3sPwAdiwY6Q+bKXT0AfLVyFCqDDlwSp0mQAV0vGAAsMsVoU0xKmptWAA2AAwBfQgHcyUJptOWbAekXSkbtFjyeZX3kArzUNbXRdfUMKY1MARgtrQg9JLx85f0lvILx8RRAAGhAnGGwYfAQAbUEYGABrAEFcAC8QAF1i+0dNSvgqgGYAJgt2qyA

Seems only to add justify-content: center (in my example) but there's no flexbox around it. Am I misunderstanding the intention? Thanks, I'm learning a lot from exploring this!

Button component generates invalid html

Hi and thanks for this awesome design system. It inspires me a lot in my current work.

I just stumbled upon something. The Button component has a lot of divs inside it which is invalid markup.

I don't know if this is something, that you decided on internally was okay to do - then you can of course just close the issue :)
If not, would it then be an option to make typescript triggering an error if a div or any other block elements is used inside the button?

Is it possible to expose build-theme-related methods?

I have reviewed the source code, and the official themes are created using methods such as makeBraidTheme and related types. Defining the values of some tokens can create a new theme. However, these methods and types are not public. I would like to know how you consider providing users with the possibility of customizing themes.

Add a Navigation Component

I'm not sure maybe I did just not found it but I'm searching for a way to have a main navigation component. Something like UI Shell in Carbon. Or How do you currently create a Navigation your applications?

Braid without Sku

Is there a way to use this design system as a standalone library outside of Sku projects?
Are there any plans to add support for that in the future?

Use in Vite

Is this currently possible? I tried and it seems like sku is a hard dependency? I really like what y'all have built so would love to be able to use it in a project! Currently pulling out bits and pieces badly 😂

Docs for CRA setup

Since I watched Mark's talk, I just love your concept of elements without surrounding blank space. It's genius!
Do you have any plans on adding the docs for other setups apart from sku? I think it would be a really amazing to be able to use it with Create React App!

Add support for Vite

Suggestion, currently braid design system does not work with Vite. Can we add support for Vite? I can contribute to this, I think I found some place that throws error, for example Vite uses import.meta.env and Braid still uses process.env

Inline covers upper elements

Box with ref passes unsupported ref to inner function component

Thanks for open sourcing Braid and Playroom. There's so much great work in these projects.

A minor bug, but worth fixing none the less. The box component always passes a ref onto the component it creates internally:

const element = createElement(component, {
className: boxStyles,
...restProps,
ref,
});

If the component is a function component, React throws a warning:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of `Box`.
    in IconInfoSvg (created by Box)

From a quick review, the fix appears to be to conditionally skip the ref if typeof component === 'function'.

Once again, thanks for these projects. Have taken a lot of inspiration from them.

Add a Date and Timepicker Component

I currently searching for a design system and I'm missing in braid design system, a date and timepicker to create date, time and datetime fields inside a form.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

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.