0.53.0 • Published 4 days ago

@cryptofi/core-ui v0.53.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 days ago

InvestiFi Core UI

InvestiFi's library of React components and UI utilities.

Getting Started

  1. Run yarn to install dependencies.
  2. Run yarn dev to launch Storybook.

Deployment Environments

How to: Add a Component

  1. Create a new directory in the components directory using the following structure. Note that a component can consist of only a React component file (tsx) or a theme files (ts) depending on how it is structured.
components/
├─ Button/
|  ├─ Button.tsx
|  ├─ buttonTheme.ts
  1. Setup the basic component structure. This simplified example demonstrates wrapping a Chakra component:
import { Button } from '@chakra-ui/react';

const CFButton = ({ children }: { children: React.reactNode }) => {
  return <Button>{children}</Button>;
};
  1. Add the component file to the root index.ts, using the Cf prefix as a namespace to differentiate between similarly named Chakra components:
export { default as CfButton } from './Button/Button'
  1. Add the component theme to the corresponding section of the src/theme.ts file under the components key.

How to: Style a Component

The reusable components exported from this library generally use separate theme files to simplify implementation of variants, sizes, etc., but simple components can also be styled directly in the component file using Chakra style props.

Guidelines:

  • Prefer responsive units like rem over pixel values
  • Use Chakra's unitless spacing values for spacing and positioning when possible
  • Refer to documentation for the corresponding Chakra UI component when styling base components

How to: Use Icons

Run the command below to (re)generate React components from SVG files located in the svg-icons directory.

yarn icons:gen

When adding a new icon, place the SVG file in the svg-icons directory, then regenerate icons and check-in the resulting changes. When adding new icons, SVGOMG can be used to optimize files and fix issues.

Following is an example of using an icon component in application code. Note that icons are named with the prefix Icon during generation and can be styled using Chakra style props.

import { IconBank } from '@cryptofi/core-ui';

const SomeComponent = () => {
  return (
    <>
      <IconBank height="10" width="10" __css={{ path: { fill: 'orange' } }} />
    </>
  );
};

How to: Use the Breakpoint Debugger

https://www.loom.com/share/c8326757734f424993f857bf7881b02e

How to: Use Unpublished Changes

To use unpublished changes to this package in another local application, follow these steps:

  1. Run yarn publish:local to build and publish locally.
  2. From the root of the other app run yarn dlx yalc link @cryptofi/core-ui to install this package from the local registry.
  3. Re-run yarn publish:local as needed to update consumers with the latest changes to this project.

See yalc docs for more info.

Tech Stack: Tooling

This project uses Rollup to build an optimized JavaScript bundle, and consumers are expected to provide necessary peer dependencies for Chakra UI and React as outlined in this project's package.json.

Vite is used in conjunction with Storybook for local development. Based on the following Vite / React template: https://github.com/The24thDS/vite-reactts18-chakra-jest-husky

0.53.0

4 days ago

0.52.0

5 days ago

0.51.0

10 days ago

0.50.0

14 days ago

0.49.0

19 days ago

0.48.0

26 days ago

0.47.0

27 days ago

0.46.0

1 month ago

0.44.0

1 month ago

0.45.0

1 month ago

0.43.0

1 month ago

0.42.0

1 month ago

0.41.0

2 months ago

0.40.0

2 months ago

0.39.0

2 months ago

0.38.0

2 months ago

0.37.0

2 months ago

0.36.0

2 months ago

0.35.0

2 months ago

0.34.0

2 months ago

0.33.0

2 months ago

0.32.0

2 months ago

0.31.0

2 months ago

0.30.0

3 months ago

0.29.0

3 months ago

0.28.0

3 months ago

0.27.0

3 months ago

0.26.0

3 months ago

0.25.0

3 months ago

0.24.0

3 months ago

0.23.0

3 months ago

0.22.0

3 months ago

0.21.0

3 months ago

0.20.0

3 months ago

0.19.0

3 months ago

0.16.0

3 months ago

0.17.0

3 months ago

0.18.0

3 months ago

0.14.5

4 months ago

0.13.0

4 months ago

0.12.1

4 months ago

0.14.0

4 months ago

0.15.0

4 months ago

0.14.1

4 months ago

0.14.2

4 months ago

0.14.3

4 months ago

0.14.4

4 months ago

0.11.0

4 months ago

0.10.0

4 months ago

0.9.0

4 months ago

0.8.0

4 months ago

0.7.0

4 months ago

0.6.0

4 months ago

0.5.0

5 months ago

0.4.0

5 months ago

0.3.0

5 months ago

0.2.0

6 months ago

0.1.0

6 months ago