I’m interested in developing multi-column layouts, inspired by Notions use of columns. I’ve created an initial widget which displays columns of content based on CSS flexbox, which is really intuitive. Though it got me thinking.
- Is there a neater way to implement this when incorporating sizable amounts of content in columns?
- How might I pass a reference to a page and render its content in a column?
- How could I render a flexbox layout of pages as an alternative to the standard HTML table? (any advice/examples appreciated here).
- I stumbled across the contenteditable attribute which got me thinking it would be interesting to implement a Notion-style database (direct editing of columns) where each cell is a page of content - click to edit/create. Again, any advice/examples/pointers appreciated here.
Existing widget below.
```space-style
.row {display: flex;flex-direction: row;flex-wrap: wrap;width: 100%;}
.column {display: flex;flex-direction: column;flex-basis: 100%;flex: 1;}
```
```space-lua
function columns(cols)
-- Create the flexbox layout
for i,v in ipairs(cols) do
cols[i] = '<div contenteditable="true" class="column">'..v ..'</div>';
end
thehtml = '<div class="row">'..table.concat(cols)..'</div>'
---Build the widget
return widget.new {
html=thehtml;
display="block";
cssClasses={"my-cols"},
events={
click=function()
editor.flashNotification("You column clicked: " .. text)
end
}
}
end
```
Inline widget
${columns({"First", "Second", "<b>Third</b>"})}
Displays as
Edit by @zef: Going to help you a bit with formatting here.