Skip to content

Commit

Permalink
Merge pull request #47 from yohamta/update-doc
Browse files Browse the repository at this point in the history
Update doc
  • Loading branch information
yohamta authored Apr 26, 2023
2 parents 22627e4 + cb48a1e commit cbc05b1
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Full source code of the example is [here](examples/game/main.go).
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Building UI with HTML](#building-ui-with-html)
- [CSS Properties](#css-properties)
- [HTML Attributes](#html-attributes)
- [Debugging](#debugging)
- [Contributions](#contributions)

Expand Down Expand Up @@ -186,6 +188,39 @@ view := (&furex.View{

For a more extensive example, check out the [example here](examples/game/main.go).

### CSS Properties

The following table lists the available CSS properties:

| CSS Property | Type | Available Values |
| -------------- | ------------ | ------------------------- |
| `left` | int | Any integer value |
| `top` | int | Any integer value |
| `width` | int | Any integer value |
| `height` | int | Any integer value |
| `margin-left` | int | Any integer value |
| `margin-top` | int | Any integer value |
| `margin-right` | int | Any integer value |
| `margin-bottom`| int | Any integer value |
| `position` | Position | `static`, `absolute` |
| `flex-direction` | Direction | `row`, `column` |
| `flex-wrap` | FlexWrap | `no-wrap`, `wrap`, `wrap-reverse` |
| `justify-content` | Justify | `flex-start`, `flex-end`, `center`, `space-between`, `space-around` |
| `align-items` | AlignItem | `stretch`, `flex-start`, `flex-end`, `center` |
| `align-content`| AlignContent | `flex-start`, `flex-end`, `center`, `space-between`, `space-around`, `stretch` |
| `flex-grow` | float64 | Any float64 value |
| `flex-shrink` | float64 | Any float64 value |
| `display` | Display | `flex`, `none` |

### HTML Attributes

The following table lists the available HTML attributes:

| HTML Attribute | Type | Available Values |
| -------------- | ------------------ | ------------------------- |
| `id` | string | Any string value |
| `hidden` | bool | `true`, `false` |

## Debugging

You can enable Debug Mode by setting the variable below.
Expand Down
11 changes: 10 additions & 1 deletion html.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,20 @@ func readAttrs(z *html.Tokenizer) attrs {
case "style":
attr.style = string(val)
case "hidden":
attr.hidden = true
v := string(val)
if v == "" {
attr.hidden = true
} else {
attr.hidden = parseBool(v)
}
}
if !more {
break
}
}
return attr
}

func parseBool(val string) bool {
return val == "true"
}

0 comments on commit cbc05b1

Please sign in to comment.