Skip to content

Commit

Permalink
Merge pull request #2 from ghivert/feat/add-html-none
Browse files Browse the repository at this point in the history
Add html.none
  • Loading branch information
ghivert authored Aug 21, 2024
2 parents 8b46412 + e7c697d commit 1cb43c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 80,
"semi": false,
"proseWrap": "always"
"proseWrap": "always",
"trailingComma": "all"
}
1 change: 1 addition & 0 deletions redraw/src/redraw.ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export function addProxy(Component) {
/** Generate JSX using the JSX factory.
* `jsx` is for dynamic components, while `jsxs` is for static components. */
export function jsx(value, props_, children_) {
if (value === "none_") return null
if (value === "text_") return children_
let children = children_?.toArray?.()
let isStatic = true
Expand Down
4 changes: 4 additions & 0 deletions redraw/src/redraw/html.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub fn title(attrs, content) {
redraw.jsx("title", attrs, [text(content)])
}

pub fn none() {
redraw.jsx("none_", Nil, Nil)
}

pub fn text(content: String) -> Component {
redraw.jsx("text_", Nil, content)
}
Expand Down

0 comments on commit 1cb43c2

Please sign in to comment.