Skip to content

Commit 3bba020

Browse files
committed
add template for components
1 parent 69eb7a5 commit 3bba020

5 files changed

Lines changed: 72 additions & 9 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
44

5-
### Installation
5+
## Installation
66

7-
```
8-
$ npm install
7+
```sh
8+
npm install
99
```
1010

11-
### Local Development
11+
## Local Development
1212

13-
```
14-
$ npm run serve
13+
```sh
14+
npm run serve
1515
```
1616

1717
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
1818

19-
### Build
19+
## Build
2020

21-
```
22-
$ npm run build
21+
```sh
22+
npm run build
2323
```
2424

2525
This command generates static content into the `build` directory and can be served using any static contents hosting service.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Components",
3+
"position": 6
4+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Best Practice
6+
7+
## HTML/CSS First
8+
9+
It is always better to start with HTML/CSS where possible. For example instead of using javascript to control modals, we can use `dialog` which is built into the browser.
10+
11+
We can use CSS to control a lot of client side visiblity and state. For example, we can use CSS to control the visibility of form elements based on the state of a checkbox. This is much easier to read and maintain than using javascript for simple cases.
12+
13+
This will also encourage simple web design that are easy to maintain and scale.
14+
15+
```html
16+
17+
```
18+
19+
## Web Components
20+
21+
When we need to use more complex complents and third party libraries such as maps, we can use web components. Web components are a set of standards that allow us to create reusable components that can be used in any web application. They are built into the browser and do not require any third party libraries.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Modal
6+
7+
Example of a reusable modal component. This is a simple modal that can be used to display information or ask for confirmation.
8+
9+
Typically this would be placed in the `/internal/ui/components` folder. A file called `modal.templ` would be created.
10+
11+
## Example
12+
13+
```templ
14+
package modal
15+
16+
17+
```
18+
19+
## Usage
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Toast
6+
7+
Example of a reusable toast component. This is a simple toast that can be used to display temporary information such as confirmations.
8+
9+
Typically this would be placed in the `/internal/ui/components` folder. A file called `toast.templ` would be created.
10+
11+
## Example
12+
13+
```templ
14+
package toast
15+
16+
17+
```
18+
19+
## Usage

0 commit comments

Comments
 (0)