1.2.0 • Published 1 year ago

eldav1d-marvel-ui v1.2.0

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

ElDav1d Marvel UI: DEVELOPMENT

This is an UI library effort consisting in the abstraction of presentational logic applied on my pet project Playing with Marvel API

It mimics the look and feel of the Marvel Characters page.

The approach relies on vite's library mode and is heavily inspired by this article and this hybrid implementation

Stack is React + TypeScript + Vite + Vitest + React Testing Library + Storybook + TailwindCSS

TailwindCSS is applied as Peer Dependency. Be dareful about conflicts with your tailwind.config.js or your version, if your project has it already installed.

Features

Support for both ECMAScript Modules and CommonJS

  • Outputs:
    • esm and cjs source files
    • source maps for JavaScript files (.js.map)
    • esm and cjs declaration files (.d.ts and .c.ts)
    • esm and cjs source maps for declaration files (.d.ts.map and .c.ts.map)
    • compiled and uglified CSS (consuming app is not required to support css modules)
  • Subpath exports for explicit path referencing. Will auto map to the right module system
  • Libraries are externalized for a lighter bundle size (react, react/jsx-runtime, tailwindcss, react-lazy-load-image-component)

Prerequisites

You need Node.js and npm or yarn installed on your machine. To check if you have Node.js installed, run this command in your terminal:

node -v
yarn -v

Install the dependencies:

npm install or yarn

Main Scripts

npm run storybook or yarn storybook

Starts the Storybook tool for developing UI components in isolation. Open http://localhost:6006 to view it in the browser.

npm run test or yarn test

Launches the test runner for the whole project.

npm run build or yarn build

Builds the app for production to the dist folder. It takes this sequence:

  • clean previous build: remove ./dist directory and its contents

  • compile JS: with specific ./tsconfig-build.json

  • build: creates production bundle on new ./dist directory

  • rename CSS file: into ./dist/lib.css preventing conflicts on consumer

  • clean irrelevant files: removes tests and stories for optimal bundle size

ElDav1d Marvel UI: USAGE

Install package

npm i 'eldav1d-marvel-ui'
yarn add 'eldav1d-marvel-ui'

Import CSS

On top of your project, in order make it available

//src/App.tsx

import 'eldav1d-marvel-ui/dist/lib.css';
...

Import and apply components constants or utilities

All available with named imports

//tailwind.config.js

import { MARVEL_RED } from 'eldav1d-marvel-ui/'
...
module.exports = {
  theme: {
    extend: {
      colors: {
        red: MARVEL_RED,
      },
    },
  },
}
//src/App.tsx

import { Loader } from 'eldav1d-marvel-ui/'
...
function App() {
  return <Loader loadingLabel={'...loading'} />
}
1.2.0

1 year ago

0.4.9

1 year ago

0.4.8

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.9

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

1.0.0

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.4

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.3.1

1 year ago

0.1.0

1 year ago

0.3.0

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.50

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.4

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.48

1 year ago

0.0.49

1 year ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.39

1 year ago

0.0.37

1 year ago

0.0.38

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.9

1 year ago

0.0.16

1 year ago

0.0.8

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago