braid-design-system

Themeable design system for the SEEK Group
授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 燕烨
操作系统 跨平台
开源组织
适用人群 未知
 软件概览


Themeable design system for the SEEK Group.


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 jobStreetTheme from 'braid-design-system/themes/jobStreet';
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 jobStreetTheme from 'braid-design-system/themes/jobStreet';
import { BraidProvider, Text } from 'braid-design-system';

export default () => (
  <BraidProvider theme={jobStreetTheme}>
    <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={jobStreetTheme} 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>
);

Multi-theme setup

If you require multiple themes and want to code split them, you can subsitute the BraidProvider with the BraidLoadableProvider, passing it the necessary themeName at runtime. Remove any explicit theme imports you may have.

import 'braid-design-system/reset';
import { BraidLoadableProvider, Text } from 'braid-design-system';

export default ({ themeName }) => (
  <BraidLoadableProvider themeName={themeName}>
    <Text>Hello World!</Text>
  </BraidLoadableProvider>
);

Style Guide Migration

If you're migrating from an existing style guide, please refer to the Style Guide Migration guide.

Local Development

This project uses Yarn for development dependencies.

Installing with yarn is required to ensure dependencies match the current yarn.lock.

$ yarn
$ yarn start

Start a local Storybook server:

$ yarn storybook

Contributing

Refer to CONTRIBUTING.md.

Thanks

Chromatic for providing component screenshot testing, powered by Storybook.

License

MIT.

 相关资料
  • Background Blockchain technology has been evolving very quickly since the introduction of Bitcoin in 2008. Over the past nine years, many Blockchain techniques have been explored to try out various id

  • 1. Web MVC Framwork: SpringMVC3.0 Restful 的风格终于回归了MVC框架的简单本质,对比之下 Struts2 概念太复杂更新又太懒了。 Template:JSP2.0 且尽量使用 JSP EL 而不是 taglib,万一要写 taglib 也用纯 JSP 来编写,一向是 SpringSide 的推荐,Freemarker 们始终有点小众, 而Thymeleaf

  • This document describes rationales for WebAssembly’s design decisions, acting as footnotes to the main design text, keeping the main specification easier to read, and making it easier to revisit decis

  • 算法是一个逐步的过程,它定义了一组指令,这些指令按特定顺序执行以获得所需的输出。 算法通常独立于底层语言创建,即算法可以用多种编程语言实现。 从数据结构的角度来看,以下是一些重要的算法类别 - Search - 搜索数据结构中的项目的算法。 Sort - Sort特定顺序对项目进行Sort算法。 Insert - 在数据结构中插入项的算法。 Update - 更新数据结构中现有项目的算法。 Del

  • When contributing large changes or features to the Prometheus ecosystem, design documents are written by individuals or groups. Those documents are proposed for review and approval to the community. T