Skip to content

Commit

Permalink
docs: update usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 6, 2024
1 parent b87c366 commit 2393f9a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 15 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,25 @@ pnpm install @hotosm/ui
### HTML / HTMX

```html
<!-- <script src="https://cdn.hotosm.org/ui/latest/core.js"> -->
<script src="https://cdn.hotosm.org/ui/v1/core.js">
// Import the components
<script
type="module"
src="https://s3.amazonaws.com/hotosm-ui/latest/ui.js"
>
// Import the styles (or create your own)
<link
rel="stylesheet"
href="https://s3.amazonaws.com/hotosm-ui/latest/style.css"
/>
<div>
<hot-button disabled="false"> </hot-button>
<hot-button disabled="true"> </hot-button>
</div>
```
See the docs for more [usage examples](https://hotosm.github.io/ui/usage/).
> core.js will contain the minimal low level components.
>
> extra.js will contain additional wrapper components.
Expand All @@ -93,7 +104,7 @@ const HomePage = ({}) => {
<div
...
>
<hot-button disabled="false">
<hot-button disabled="true">
</hot-button>
</div>
</div>
Expand Down
61 changes: 51 additions & 10 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,62 @@
# Usage

## Code
It production either the HOT S3-based CDN can be used, or JSDelivr.

```js
<script src="https://hotosm.github.io/ui/dist/core.js">
## AWS S3 CDN

<div>
<hot-button intent="primary"> </hot-button>
</div>
```html
// Import the components
<script
type="module"
src="https://s3.amazonaws.com/hotosm-ui/latest/ui.js"
>
// Import the styles (or create your own)
<link
rel="stylesheet"
href="https://s3.amazonaws.com/hotosm-ui/latest/style.css"
/>
<hot-button>Click Me!</hot-button>
```
## JSDelivr (NPM CDN)
```html
<script
type="module"
src="https://cdn.jsdelivr.net/gh/hotosm/ui@latest/dist/ui.js"
></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/hotosm/ui@latest/dist/style.css"
/>

<hot-button>Click Me!</hot-button>
```

## Github Pages

This deployment is mostly use for development and tracks the most recent
changes.

```html
<script
type="module"
src="https://hotosm.github.io/ui/dist/ui.js"
>
<link
rel="stylesheet"
href="https://hotosm.github.io/ui/dist/style.css"
/>
<hot-button>Click Me!</hot-button>
```
## Visual Representation
## Example
<!-- markdownlint-disable -->
<div>
<hot-button intent="primary">Click Me!</hot-button>
</div>
<hot-button>Click Me!</hot-button>
<!-- markdownlint-enable -->
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ theme:
# custom_dir: docs/overrides

extra_javascript:
- https://hotosm.github.io/ui/dist/core.js
- https://s3.amazonaws.com/hotosm-ui/latest/ui.js

extra_css:
- css/extra.css
- https://cdn.jsdelivr.net/gh/hotosm/ui@latest/dist/style.css

markdown_extensions:
- tables
Expand Down

0 comments on commit 2393f9a

Please sign in to comment.