karuto-typography-temp

0.0.12 • Public • Published

typography-desktop

What is this?

typography-desktop is a package that exports font grouping CSS classes, such as .xlarge-bold, for consumer web projects to consume.

These classes are generated dynamically based on the latest version of otkit-typography-desktop design token.

Why are you doing this?

The way different consumer web teams apply typography styling to their front end components is very fragmented. We have lots of duplications, overrides and human errors.

We try to solve this problem by enforcing consistency via encapsulating the entire design decision inside CSS classes.

I choose CSS class as the transport mechanism because of its simplicity, familiarity and flexibility.

How is this package set up?

Let's briefly explain the decision flow when it comes to typography. Let's use .xlarge-bold as example.

  1. Designers decided xlarge-bold should be one of the desktop web typography groupings inside their design system.
  2. Design tokens deconstructs xlarge-bold into atomic elements, such as xlarge-bold-font-size, xlarge-bold-font-weight and xlarge-bold-line-height, and stores them inside otkit-typography-desktop token.
  3. We import these values from design tokens, reconstructing the composited .xlarge-bold, which serves as a 1:1 model / engineering translation of the design decision.
  4. You, as a developer of a consumer web project, can then use it.

How do I use it / how does it help me?

Let's expand bullet point number 4 from above.

TL;DR: No more repeating the same CSS declarations - font sizes, font weights, line heights, even class compositions - over and over again!

To use it, simply install:

npm i --save-dev @ot-react-ui/typography-desktop

Then depends on your choice of CSS technologies, there are many ways to consume this package:

CSS modules

.some-component-class {
  composes: xlarge-bold from '@ot-react-ui/typography-desktop';
}

Sass / Scss

@import '@ot-react-ui/typography-desktop';
.some-component-class {
  @extend: .xlarge-bold; // or you can just use the class names directly
}

Vanilla CSS

If your project uses vanilla CSS you can simply import it in your bundle then use the class names directly.

Developement guide

Environment

This package requires node 8. Other node versions may throw errors when you run scripts.

This package requires npm 5, if you'd like to publish. We are using features that's only available after npm 4.

Installation

npm i

Publishing

Before you publish, please make sure your .npmrc is pointing to the OpenTable private registry with correct credentials.

Please also make sure you have already installed all dependencies for this package and have the correct node / npm versions.

This package should only be published by running:

npm run update-publish

Support

Please contact Vincent Zhang and Lin Xu if you have any questions regarding this package.

Dependents (0)

Package Sidebar

Install

npm i karuto-typography-temp

Weekly Downloads

1

Version

0.0.12

License

ISC

Unpacked Size

6.16 kB

Total Files

5

Last publish

Collaborators

  • vzhang