-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactive Guides #65
Conversation
@BrooklinJazz this PR seems fine but I didn't do a content review. Let's do the content review on our call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I really like the "Your Turn" sections.
I think some other useful elements to include would be:
List
- provides a system-specific interface, and has better performance for large amounts of scrolling elementsScrollView
- more customizable than list. This could also mentionLazyVStack
,LazyHStack
,LazyVGrid
, andLazyHGrid
. These are crucial for performance when usingScrollView
with large amounts of items, and should be preferred overVStack
,HStack
, andGrid
for scrollable content.TextField
,Toggle
,Stepper
,DatePicker
, and other form controls
Co-authored-by: Carson Katri <[email protected]>
Co-authored-by: Carson Katri <[email protected]>
Co-authored-by: Carson Katri <[email protected]>
I've added everything except for the form controls, as they are covered in the event bindings/interactive views section. |
List Selection def mount(_params, _session, socket) do
{:ok, assign(socket, selection: "1")}
end
def render(assigns) do
~SWIFTUI"""
<List selection={@selection} phx-change="selection-changed">
<Text id={"#{i}"} :for={i <- 1..10}><%= i %></Text>
</List>
"""
end
def handle_event("selection-changed", %{ "selection" => selection }, socket) do
{:noreply, assign(socket, selection: selection)}
end Hierarchical List (Disclosure Group) <List>
<DisclosureGroup>
<Text template="label">Level 1</Text>
<DisclosureGroup>
<Text template="label">Level 2</Text>
<DisclosureGroup>
<Text template="label">Level 3</Text>
Content
</DisclosureGroup>
</DisclosureGroup>
</DisclosureGroup>
</List> Hierarchical List (Section) <List>
<Section>
<Text template="header">Header</Text>
Content
<Text template="footer">Footer</Text>
</Section>
</List> Refreshable List (requires liveview-native/liveview-client-swiftui#1212) def render(assigns) do
~SWIFTUI"""
<List class="refreshable">
<Text id={"#{i}"} :for={i <- 1..10}><%= i %></Text>
</List>
"""
end
def handle_event("refresh", _params, socket) do
{:noreply, socket}
end Stylesheet: "refreshable" do
refreshable(action: event("on-refresh"))
end |
@carson-katri Thank you for the help with examples. Do we have a way of supporting multiple selection? |
@BrooklinJazz Good question, we used to support it with |
…ge LiveVIew names to be unique in examples
Co-authored-by: Carson Katri <[email protected]>
Overview
This PR introduces the following guides:
**Testing this PR requires the
main
version of Livebook. You can go here to install it using Escript: https://github.com/livebook-dev/livebook#escriptThis PR also introduces the
mix ex_doc_guides
task, which formats the.livemd
files into.md
files. These.md
files have content stripped and other formatting improvements, such as the run-in livebook badge.