Add fonts, autotable, autotable examples
This commit is contained in:
@@ -9,7 +9,7 @@ import "kjol/vdom"
|
||||
// children. That matches the TSX, whose body is `props.children` (rows built with
|
||||
// AutoTable's TdLeft/TdRight/TdCenter cells). Those cell helpers live in AutoTable
|
||||
// (not ported here), so callers build rows with the vdom tag builders directly,
|
||||
// e.g. vdom.El("tr", vdom.El("td", vdom.Attr("class","text-right"), vdom.Text(...))).
|
||||
// e.g. vdom.Tr(vdom.Td(vdom.Attr("class","text-right"), vdom.Text(...))).
|
||||
// (CellGrid is the component that models columns + a per-cell Render func.)
|
||||
//
|
||||
// The enum values, class maps, and shared class strings that PrettyTable.tsx
|
||||
@@ -167,11 +167,10 @@ func PrettyTable(columns []PrettyTableColumn, opts PrettyTableOptions, children
|
||||
thCls = cx(thCls, col.HeaderClasses)
|
||||
|
||||
innerCls := cx(ptHeaderInnerBase, ptHeaderInnerPos[pos])
|
||||
headerCells = append(headerCells, vdom.El("th",
|
||||
vdom.Attr("class", thCls),
|
||||
vdom.El("div", vdom.Attr("class", ptHeaderContent),
|
||||
vdom.El("div", vdom.Attr("class", innerCls),
|
||||
vdom.El("div", vdom.Attr("class", cx("grow text-sm", ptHeaderTextCls[opts.Color])),
|
||||
headerCells = append(headerCells, vdom.Th(vdom.Attr("class", thCls),
|
||||
vdom.Div(vdom.Attr("class", ptHeaderContent),
|
||||
vdom.Div(vdom.Attr("class", innerCls),
|
||||
vdom.Div(vdom.Attr("class", cx("grow text-sm", ptHeaderTextCls[opts.Color])),
|
||||
vdom.Text(col.DisplayName),
|
||||
),
|
||||
),
|
||||
@@ -179,16 +178,15 @@ func PrettyTable(columns []PrettyTableColumn, opts PrettyTableOptions, children
|
||||
))
|
||||
}
|
||||
|
||||
thead := vdom.El("thead",
|
||||
vdom.Attr("class", "[&_th]:border-b [&_th]:border-neutral-300"),
|
||||
vdom.El("tr", kids(nil, headerCells)...),
|
||||
thead := vdom.Thead(vdom.Attr("class", "[&_th]:border-b [&_th]:border-neutral-300"),
|
||||
vdom.Tr(kids(nil, headerCells)...),
|
||||
)
|
||||
|
||||
tbody := vdom.El("tbody", kids([]vdom.Mod{vdom.Attr("class", prettyTableBodyClass(opts))}, children)...)
|
||||
tbody := vdom.Tbody(kids([]vdom.Mod{vdom.Attr("class", prettyTableBodyClass(opts))}, children)...)
|
||||
|
||||
return vdom.El("div", vdom.Attr("class", containerCls),
|
||||
vdom.El("div", vdom.Attr("class", ptTblWrapper),
|
||||
vdom.El("table", vdom.Attr("class", tableCls), thead, tbody),
|
||||
return vdom.Div(vdom.Attr("class", containerCls),
|
||||
vdom.Div(vdom.Attr("class", ptTblWrapper),
|
||||
vdom.Table(vdom.Attr("class", tableCls), thead, tbody),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user