Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@charlietango/ui

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@charlietango/ui

Collection of shared UI elements for Charlie Tango projects

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
-81.82%
Maintainers
1
Weekly downloads
 
Created
Source

Charlie Tango UI

Version Badge dependency status dev dependency status License styled with prettier

A set of UI components built with Emotion and styled-system, to be used between Charlie Tango projects.

It's built for Emotion 11 (still in beta, but should be finalized soon), so it can be used with the @emotion/react package.

Installation

yarn add @charlietango/ui @emotion/react

@charlietango/babel-preset-sx-prop

You should add @charlietango/babel-preset-sx-prop to enable full support for the sx prop. This is a custom version of @emotion/babel-preset-css-prop, and replaces it (still includes support for the css prop).

yarn add @charletango/babel-preset-sx-prop --dev

Add the preset to the project .babelrc

{
  "presets": ["@charlietango/babel-preset-sx-prop"]
}

Custom JSX pragma

If you can't add @charlie-tango/babel-preset-sx-prop to the project, you can still use the sx prop by defining a custom JSX Pragma in the React file.

Include this at the top of the file:

/** @jsx jsx */
import { jsx } from '@charlietango/ui';

This replaces the normal import * as React from 'react' (which imports the default JSX from React).

Planned components

ComponentStatus
AccordionTodo
TabsTodo
Modal
VisuallyHidden

Bundling

The library is built for ESNext, and does not contain a CommonJS build. This means you will need to compile the library with the consuming applications bundler. Usually tools skip processing node_modules to speed up the build process, so you will need to configure this.

Webpack

Include the @charlietango namespace in the babel-loader rule:

const config = {
  modules: {
    rules: [
      {
        test: /\.(js|ts|tsx)$/,
        include: [path.resolve('src'), path.resolve('node_modules/@charlietango')],
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: DEBUG,
            },
          },
        ],
      },
    ],
  },
};

Jest

Jest will also need to include the library when transforming files:

const config = { transformIgnorePatterns: ['/node_modules/(?!@charlietango).+\\.js$'] };

Contributing

Storybook development

All the components should be documented using Storybook. We are using the Storybook MDX format to ensure we have examples alongside the documentation.

Testing in another project

You can use yarn link to test changes to the library in another one of your projects.

In the charlie-tango/ui project run:

yarn link
yarn dev:watch

In the consuming test project, link the project:

yarn link "@charlietango/ui"

You will now be able to see changes immediately.

Publish

We are using semantic-release to automatically publish a new package, whenever we merge to master. It's important to use the Angular Commit Message Conventions so the version can be correctly bumped.

Keywords

emotion

FAQs

Package last updated on 09 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts