Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and simplify #62

Merged
merged 22 commits into from
Oct 21, 2024
Merged

Refactor and simplify #62

merged 22 commits into from
Oct 21, 2024

Conversation

emi420
Copy link
Collaborator

@emi420 emi420 commented Oct 9, 2024

Sorry, this is a big PR :)

Refactor & simplify

Things were somewhat complex for me to understand, things were not working on all use cases/frameworks.

My strategy was to start with the Shoelace code as an inspiration, not only because we're using Shoelace components but because the goal is similar: to have a web components UI library with React support.

I removed Vite, Uno and other additional things. I think it's better to have something easy, simple and clear, then once we go forward with the development and reach certain stability we can add any tool that's useful for optimization or development.

How to test this PR

You can install the branch on any project that uses either web components or React (18/19), directly from the dev branch of this repository:

npm install "hotosm/ui#dev"

Then, include the style sheet and some components, both from Shoelace and HOT custom ones, and check that everything works all right.

Screenshot 2024-10-09 at 14 47 15

Web components

import '@hotosm/ui/dist/style.css';
import { Button, Logo } from '@hotosm/ui/dist/hotosm-ui.js';

<hot-logo></hot-logo>
<hot-button variant="success">Click me!</hot-button>

React

import '@hotosm/ui/dist/style.css';
import { Logo, Button } from '@hotosm/ui/dist/react';

<Logo />
<br /> 
<Button variant="primary">Click me</Button>

Build

pnpm run build

Build is performed by an simple script (scripts/build.js) that calls a compiler (tsc) and a bundler (esbuild).

Then, it just copy some files (assets and styles) to dist, that's the folder we'll release for distributing the package.

Exports are defined in the exports section of package.json.

Docs

I've started more complete and clear docs using Storybook doc blocks which includes also docs for color and typography styling, developed following specifications for a HOT UI design system based on the HOT branding guidelines.

Storybook for React was removed because it was not really useful for testing.

Examples were also removed, we can add them to the docs directly.

Bundled version via CDN was removed for now, for reducing complexity and because the most common use and main priority is to have the library as a NPM package.

@github-actions github-actions bot added documentation Improvements or additions to documentation dependency labels Oct 9, 2024
@emi420 emi420 changed the title Dev Refactor and simplify Oct 9, 2024
Copy link
Member

@spwoodcock spwoodcock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice Looks good on review, although I haven't run it myself yet 😄

You mention the examples have been removed. Originally they were included just to prove that it works in a few different frameworks.

Some of the examples had specific implementation details that were documented (such as Vue needing some specific config params to work). Do you think this might be useful to a potential developer needing to use our lib?

@emi420
Copy link
Collaborator Author

emi420 commented Oct 16, 2024

Some of the examples had specific implementation details that were documented (such as Vue needing some specific config params to work). Do you think this might be useful to a potential developer needing to use our lib?

Yes! I'll add that in the docs , thanks @spwoodcock

@spwoodcock spwoodcock merged commit c8864ca into main Oct 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants