16.2.1 • Published 4 years ago

seek-asia-style-guide v16.2.1

Weekly downloads
34
License
MIT
Repository
github
Last release
4 years ago

CircleCI

seek-asia-style-guide

Living style guide for SEEK ASIA, powered by React, webpack, CSS Modules and Less.

If you're creating a new project from scratch, consider using sku, our officially supported front-end development toolkit. It's specially designed to get your project up and running as quickly as possible, while simplifying the process of keeping your development environment up to date.

Demo site

The easiest way to explore the components offered by the style guide is browsing the demo site - use the hamburger menu to access the goodies.

You can also run the demo site locally by checking out this repo and running npm start

Installation

If you want to add SEEK Asia Style Guide to your app, install it with npm or yarn:

$ npm install --save seek-asia-style-guide

If you want to dev on the style guide itself or run the demo page, clone this repository and npm install then npm start to start the demo page locally. See CONTRIBUTING.md for a complete guide.

Upgrading

Consumers can stay up to date by following our release notes, which are published automatically whenever a new release is published to npm.

Working with sku

sku needs to be told you're using seek-asia-style-guide to pass the components through babel. In your sku.config.js file, add seek-asia-style-guide to the compilePackages array:

module.exports = {
  compilePackages: ['seek-asia-style-guide']
};

Setup

Wrap your app with the StyleGuideProvider component to use any of the style guide components. For example:

import React, { Component } from 'react';
import { StyleGuideProvider } from 'seek-asia-style-guide/react';

export default class App extends Component {
  render() {
    const title = '...';
    const meta = [
      { name: 'description', content: '...' }
    ];
    const link = [
      { rel: 'canonical', href: 'https://www.seekasia.com/' }
    ];

    return (
      <StyleGuideProvider title={title} meta={meta} link={link}>
        ...
      </StyleGuideProvider>
    );
  }
};

StyleGuideProvider's props are used to set the page head properties using Helmet.

High Level Components

As much as possible, you should aim to minimise the amount of custom CSS you need to write. This is achieved by leveraging our suite of high level components, which are demonstrated on our style guide documentation site.

Headers

Please use the branded headers under JobStreet and JobsDB for candidate-facing sites. They consume the same underlying header component but you may find it useful to avoid importing the assets of the second brand in a particular build if your users will only see one of them at runtime.

If you're building a variant branded experience, you should consume the underlying <Header /> component in /react. Note it has a fairly extensive API, see the JobStreet and JobsDB components for examples of how to pass props in to the <Header /> component.

Low Level Styling

For more advanced pages, if you need to drop down into Less, the style guide provides a set of mixins and variables to make it easier to stay on brand.

In any style sheet that depends on the style guide, first import the Less theme by reference.

@import (reference) "~seek-asia-style-guide/theme";

Responsive Breakpoint

The style guide exposes one responsive breakpoint:

@responsive-breakpoint: 740px;

Content should otherwise be responsive within its container. The set of included components follow this model internally if you'd like to get a sense of what this looks like in practice.

Z-Indexes

To ensure correct relative elements stacking order, z-index variables are provided:

@z-index-header-overlay
@z-index-header
@z-index-page-overlay
@z-index-inline-overlay
@z-index-negative

Grid Variables

In order to ensure elements correctly follow the grid, element sizing should always be controlled by the following variables:

@grid-row-height
@grid-gutter-width
@grid-column-width
@grid-container-width

When defining a document content container:

.element {
  max-width: @grid-container-width;
}

When defining heights and vertical padding/margins:

.element {
  height: (@grid-base * 6);
  padding-bottom: @grid-base;
  margin-bottom: @grid-base * 2;
}

It's important to note that any additions to these values (e.g. borders) will need to be negated to maintain rhythm:

.element {
  @border-width: 1px;
  border-bottom: @border-width solid @sk-charcoal;
  padding-bottom: @grid-base * 2 - @border-width;
}

Advanced Usage

Optimising Imports

When importing from the style guide, while it might appear that you are only importing what's needed, it's highly likely that you're actually including the entire style guide in your application bundle (even when using tree shaking in webpack 2).

In order to help you optimise your bundle size, all components can be imported directly from their individual source files. For example, take a look at standard import statement:

import { Section, Card } from 'seek-asia-style-guide/react';

This can also be expressed as separate, file-level imports:

import Section from 'seek-asia-style-guide/react/Section/Section.js';
import Card from 'seek-asia-style-guide/react/Card/Card.js';

Rather than transforming this manually, it's recommended that you leverage Babel instead, with babel-plugin-transform-imports configured to match the pattern used in this style guide.

To set this up, assuming you're already using Babel, first install the plugin:

npm install --save-dev babel-plugin-transform-imports

Then, include the following in your Babel config:

"plugins": [
  ["babel-plugin-transform-imports", {
    "seek-asia-style-guide/react": {
      "transform": "seek-asia-style-guide/react/${member}/${member}",
      "preventFullImport": true
    }
  }]
]

Sketch asset generation

On every successful build (via npm test), asketch.json files (i.e. almost Sketch files) are generated by html-sketchapp containing document styles and symbols. These are provided via the following JSON files:

  • dist/asketch/document.asketch.json
  • dist/asketch/page.asketch.json

These can be manually imported into Sketch by downloading html-sketchapp and installing asketch2sketch.sketchplugin.

Once in Sketch, open the "Plugins" menu and select "From *Almost* Sketch to Sketch". Assuming you've run a full build of the style guide via npm test, you should now be able to select the asketch.json files in dist/asketch.

SEEK Style Guide

This is a fork of seek-style-guide, and we are still taking upstream merges to take advantage of the rapid pace of that project. This gives us an elevated starting point, at the cost of quite a lot of SEEK ANZ specific branding styles remaining in the repo.

WIP

seek-asia-style-guide is rapidly accumulating SEEK Asia, JobsDB and JobStreet branding but does not yet offer a simple and canonical way to consume them (and avoid any SEEK ANZ remainders). This is a high priority to improve the accessibility of the repo for consuming apps.

Note for Window user

Note that certain command might not be working as expected in window. if you encounter a problem when executing a command, look at the 'scripts' in package.json. Try to find a similar command with the postfix '-in-window'.

eg. On a window, if you want to update the snapshot, you'll need to run the following command npm run test-unit-in-window -- -u

Contributing

Refer to CONTRIBUTING.md

If you're planning to change the public API, please open a new issue and follow the provided RFC template in the GitHub issue template.

License

MIT.

16.2.1

4 years ago

16.2.0

4 years ago

16.1.0

5 years ago

16.0.14

5 years ago

16.0.13

5 years ago

16.0.12

5 years ago

16.0.11

5 years ago

16.0.10

5 years ago

16.0.9

5 years ago

16.0.8

5 years ago

16.0.7

5 years ago

16.0.6

5 years ago

16.0.5

5 years ago

16.0.4

5 years ago

16.0.3

5 years ago

16.0.2

5 years ago

16.0.1

5 years ago

16.0.0

5 years ago

15.2.1

5 years ago

15.2.0

5 years ago

15.1.0

5 years ago

15.0.0

5 years ago

14.1.4

5 years ago

14.1.3

5 years ago

14.1.2

5 years ago

14.1.1

5 years ago

14.1.0

5 years ago

14.0.3

5 years ago

14.0.2

5 years ago

14.0.1

5 years ago

14.0.0

5 years ago

13.2.3

5 years ago

13.2.2

5 years ago

13.2.1

5 years ago

13.2.0

5 years ago

13.1.1

5 years ago

13.1.0

5 years ago

13.0.1

5 years ago

13.0.0

5 years ago

12.8.1

5 years ago

12.8.0

5 years ago

12.7.2

5 years ago

12.7.1

5 years ago

12.7.0

5 years ago

12.6.4

5 years ago

12.6.3

5 years ago

12.6.2

5 years ago

12.6.1

5 years ago

12.6.0

5 years ago

12.5.4

5 years ago

12.5.3

5 years ago

12.5.2

5 years ago

12.5.1

5 years ago

12.5.0

5 years ago

12.4.3

5 years ago

12.4.2

5 years ago

12.4.1

5 years ago

12.4.0

5 years ago

12.3.0

5 years ago

12.2.0

5 years ago

12.1.1

5 years ago

12.1.0

5 years ago

12.0.0

5 years ago

11.2.0

5 years ago

11.1.0

5 years ago

11.0.0

5 years ago

10.1.5

5 years ago

10.1.4

5 years ago

10.1.3

5 years ago

10.1.2

5 years ago

10.1.1

5 years ago

10.1.0

5 years ago

10.0.6

5 years ago

10.0.5

5 years ago

10.0.4

5 years ago

10.0.3

5 years ago

10.0.2

5 years ago

10.0.1

5 years ago

10.0.0

5 years ago

9.0.1

5 years ago

9.0.0

5 years ago

8.3.1

5 years ago

8.3.0

5 years ago

8.2.0

5 years ago

8.1.6

5 years ago

8.1.5

5 years ago

8.1.4

5 years ago

8.1.3

5 years ago

8.1.2

5 years ago

8.1.1

5 years ago

8.1.0

5 years ago

8.0.2

5 years ago

8.0.1

5 years ago

8.0.0

5 years ago

7.0.0

5 years ago

6.32.4

5 years ago

6.32.3

5 years ago

6.32.2

5 years ago

6.32.1

5 years ago

6.32.0

5 years ago

6.31.0

5 years ago

6.30.0

5 years ago

6.29.0

5 years ago

6.28.0

5 years ago

6.27.0

5 years ago

6.26.4

5 years ago

6.26.3

5 years ago

6.26.2

5 years ago

6.26.1

5 years ago

6.26.0

5 years ago

6.25.1

5 years ago

6.25.0

5 years ago

6.24.1

5 years ago

6.24.0

5 years ago

6.23.0

5 years ago

6.22.1

5 years ago

6.22.0

5 years ago

6.21.3

5 years ago

6.21.2

5 years ago

6.21.1

5 years ago

6.21.0

5 years ago

6.20.1

5 years ago

6.20.0

5 years ago

6.19.5

5 years ago

6.19.4

5 years ago

6.19.3

5 years ago

6.19.2

5 years ago

6.19.1

5 years ago

6.19.0

5 years ago

6.18.0

5 years ago

6.17.2

5 years ago

6.17.1

5 years ago

6.17.0

5 years ago

6.16.0

5 years ago

6.15.1

5 years ago

6.15.0

5 years ago

6.14.2

5 years ago

6.14.1

5 years ago

6.14.0

5 years ago

6.13.1

5 years ago

6.13.0

6 years ago

6.12.1

6 years ago

6.12.0

6 years ago

6.11.1

6 years ago

6.11.0

6 years ago

6.10.5

6 years ago

6.10.4

6 years ago

6.10.3

6 years ago

6.10.2

6 years ago

6.10.1

6 years ago

6.10.0

6 years ago

6.9.3

6 years ago

6.9.2

6 years ago

6.9.1

6 years ago

6.9.0

6 years ago

6.8.0

6 years ago

6.7.0

6 years ago

6.6.2

6 years ago

6.6.1

6 years ago

6.6.0

6 years ago

6.5.0

6 years ago

6.4.3

6 years ago

6.4.2

6 years ago

6.4.1

6 years ago

6.4.0

6 years ago

6.3.0

6 years ago

6.2.1

6 years ago

6.2.0

6 years ago

6.1.1

6 years ago

6.1.0

6 years ago

6.0.0

6 years ago

5.27.2

6 years ago

5.27.1

6 years ago

5.27.0

6 years ago

5.26.1

6 years ago

5.26.0

6 years ago

5.25.0

6 years ago

5.24.1

6 years ago

5.24.0

6 years ago

5.23.1

6 years ago

5.23.0

6 years ago

5.22.1

6 years ago

5.22.0

6 years ago

5.21.0

6 years ago

5.20.0

6 years ago

5.19.0

6 years ago

5.18.0

6 years ago

5.17.0

6 years ago

5.16.1

6 years ago

5.16.0

6 years ago

5.15.0

6 years ago

5.14.0

6 years ago

5.13.0

6 years ago

5.12.1

6 years ago

5.12.0

6 years ago

5.11.0

6 years ago

5.10.1

6 years ago

5.10.0

6 years ago

5.9.0

6 years ago

5.8.1

6 years ago

5.8.0

6 years ago

5.7.0

6 years ago

5.6.0

6 years ago

5.5.1

6 years ago

5.5.0

6 years ago

5.4.1

6 years ago

5.4.0

6 years ago

5.3.0

6 years ago

5.2.1

6 years ago

5.2.0

6 years ago

5.1.1

6 years ago

5.1.0

6 years ago

5.0.0

6 years ago

4.24.0

6 years ago

4.23.3

6 years ago

4.23.2

6 years ago

4.23.1

6 years ago

4.23.0

6 years ago

4.22.0

6 years ago

4.21.0

6 years ago

4.20.0

6 years ago

4.19.1

6 years ago

4.19.0

6 years ago

4.18.0

6 years ago

4.17.0

6 years ago

4.16.1

6 years ago

4.16.0

6 years ago

4.15.1

6 years ago

4.15.0

6 years ago

4.14.1

6 years ago

4.14.0

6 years ago

4.13.0

6 years ago

4.12.0

6 years ago

4.11.0

6 years ago

4.10.1

6 years ago

4.10.0

6 years ago

4.9.0

6 years ago

4.8.1

6 years ago

4.8.0

6 years ago

4.7.1

6 years ago

4.7.0

6 years ago

4.6.5

6 years ago

4.6.4

6 years ago

4.6.3

6 years ago

4.6.2

6 years ago

4.6.1

6 years ago

4.6.0

6 years ago

4.5.3

6 years ago

4.5.2

6 years ago

4.5.1

6 years ago

4.5.0

6 years ago

4.4.0

6 years ago

4.3.0

6 years ago

4.2.0

6 years ago

4.1.6

6 years ago

4.1.5

6 years ago

4.1.4

6 years ago

4.1.3

6 years ago

4.1.2

6 years ago

4.1.1

6 years ago

4.1.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.2.3

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.1.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.19.2

6 years ago

1.19.1

6 years ago

1.19.0

6 years ago

1.18.1

6 years ago

1.18.0

6 years ago

1.17.0

6 years ago

1.16.0

6 years ago

1.15.1

6 years ago

1.15.0

6 years ago

1.14.1

7 years ago

1.14.0

7 years ago

1.13.0

7 years ago

1.12.0

7 years ago

1.11.0

7 years ago

1.10.1

7 years ago

1.10.0

7 years ago

1.9.1

7 years ago

1.9.0

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago