Skip to content
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

Implement Grid/GridRow #182

Merged
merged 6 commits into from
Feb 16, 2023
Merged

Implement Grid/GridRow #182

merged 6 commits into from
Feb 16, 2023

Conversation

carson-katri
Copy link
Contributor

@carson-katri carson-katri commented Feb 14, 2023

Closes #97 and #98.

<grid modifiers={@native |> frame(width: 350, height: 300)}>
    <grid-row alignment="top">
        <text>Row 1</text>
        <%= for _ <- 1..2 do %>
            <rectangle fill-color="system-red" />
        <% end %>
    </grid-row>
    <divider />
    <grid-row>
        <text>Row 2</text>
        <%= for _ <- 1..5 do %>
            <rectangle fill-color="system-green" />
        <% end %>
    </grid-row>
    <divider />
    <grid-row alignment="bottom">
        <text>Row 3</text>
        <%= for _ <- 1..4 do %>
            <rectangle fill-color="system-blue" />
        <% end %>
    </grid-row>
</grid>

TODO

A few modifiers need to be implemented:

@carson-katri
Copy link
Contributor Author

Modifiers are implemented on the Elixir side here: liveview-native/live_view_native_swift_ui#7.

Screenshot 2023-02-14 at 4 44 08 PM

<grid alignment="leading">
    <grid-row>
        <text modifiers={@native |> grid_column_alignment(guide: :trailing)}>Regular font:</text>
        <text>Helvetica 12</text>
        <button>Select...</button>
    </grid-row>
    <grid-row>
        <text>Fixed-width font:</text>
        <text>Menlo Regular 11</text>
        <button>Select...</button>
    </grid-row>
    <grid-row alignment="bottom">
        <rectangle fill-color="system-clear" modifiers={@native |> grid_cell_unsized_axes(axes: :all)} />
        <toggle modifiers={@native |> grid_cell_columns(count: 2)}>
            Use fixed-width font for new documents
        </toggle>
    </grid-row>
</grid>

@carson-katri carson-katri linked an issue Feb 15, 2023 that may be closed by this pull request
Copy link
Contributor

@shadowfacts shadowfacts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but the dividers in your example template don't seem to be present in the screenshot. Are they actually not appearing, or was the template/screenshot just out of sync?

@carson-katri
Copy link
Contributor Author

carson-katri commented Feb 15, 2023

The screenshot was out of sync. It looks like this:

@carson-katri carson-katri merged commit e39b0a3 into main Feb 16, 2023
@carson-katri carson-katri deleted the grid branch February 16, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SwiftUI -> Layout Containers -> Grids: GridRow SwiftUI -> Layout Containers -> Grids: Grid
2 participants