1.1.42 • Published 4 years ago

@rexlabs-spicerhaart/text v1.1.42

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
4 years ago

Text - Heidi Component

Text applies consistent configurable text styles throughout an application's UI. This configuration must be one layer deep with style primitives as values, and is provided to the application through a top-level TextProvider.

Text type can reference text properties via a string or array (to combine multiple configured text styles). Text solves the following problems:

  • Reduce boilerplate for styling UI text. As one of the most used components in a system, it is focused on providing convenience
  • Apply styling rules globally, to be accessed optionally
  • Emphatically not intended to be used for content typography

Application

import Text, {TextProvider, withText} from '@rexsoftware/text'
TextProvider

Wrap the top level of your application to provide a standardised configuration file of namespaced style primitives for UI text styling.

Text

Wrap UI text content in Text to control html tags and application-wide styling. Text's type prop maps to the namespaces of the configuration passed to TextProvider, composed on top of a style reset to normalize the UI.

withText

An escape hatch for more complex UI requirements. Composing a component with withText will give it access to the namespaced text styles provided by TextProvider. Text is built with withText.

Development

Install dependencies

$ yarn

Available Commands

$ yarn start              # starts storybook, for visually testing text
$ yarn test               # runs all units tests
$ yarn test:watch         # runs unit tests when files change
$ yarn build              # bundles the package for production

Legal

Copyright © 2018 Rex Software All Rights Reserved.