1.0.6 • Published 2 years ago

@spake/ui-next v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Ookla Common UI (Next)

This is a prototype POC of an updated common-ui. 4 existing common UI components have been migrated as-is with tests.

Built with

  • Typescript
  • Rollup
  • Postcss

The problem

Today, common-ui components, styles, and svgs are published separately. This mean applications that import the components also need to bundle their styles, svgs, etc as part of the application bundle. This is becoming an obstacle to upgrading our bundling configuration in applications that use common-ui.

The solution

Publish bundled common-ui components with scoped styles and assets.

What's different

This update uses Rollup to export React components bundled with scoped styles and svgs and automatic Typescript type declarations.

  • Using Rollup instead of Webpack
  • Typescript instead of Proptypes
  • Updated PostCss configuration
  • Proptypes have been migrated to typescript and declarations are exported automatically - When components are imported in TS apps, they will come with type hints and code completion

What's the same

  • CSS modules can still be used to apply scoped styles to components - but now they're bundled before they're published so the parent application just needs to import them. No need to import or bundle styles or SVGs
  • Custom css properties are still injected from a javascript file; only, it's handled by postcssPresetEnv instead of postcssnext.
  • No preprocessors needed- postcss supports nesting out of the box and other features can be added via plugins (postcss will process scss automatically, though.)

Problems (Migrate or Rewrite)

The ideal solution would be to make some improvements and updates to the existing common-ui codebase but because of how long it's been since some of these components were written and how much has changed, it may be worth it to reimplement some of them from scratch.

What's missing

  • A lot of components - Migrating remaining components is not trivial
  • The pattern library (We should probably move this to storybook - possibly outside of this package)

Docs

This project contains shared React components so that developers can create interfaces quickly and cohesively across projects.

Prerequisites

This module assumes that your app is a React 16 application.

How to Use

  1. Install the module from NPM $ yarn add @ookla/common-ui@2.0.0-alpha-ui-next.0 --save

  2. Import your component using import { Button } from '@ookla/common-ui'

disclaimer - Once you've installed the package, you should either lock to the specific version, or subscribe to patches. Minor bumps are considered "changing" and could impact your UI.

Local development

  1. use yarn link to use a local copy of the common-ui repo in another project. from common-ui root run yarn link. then from the project root run yarn link @ookla/common-ui.

  2. from the common-ui project root, run yarn rollup.

Included Components

  • Alert
  • Button
  • Flyout
  • Icon
  • Spinner

Testing

We are using the Jest framework for testing, which is similar to the Mocha/Chai/Sinon stack but with a React flavor.

To Run tests:

  • yarn test will initiate a test pass.
1.0.7

2 years ago

1.0.6

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago