Skip to content

Commit

Permalink
karm-kira: FIxup row insets.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Oct 28, 2024
1 parent a2c06f5 commit 3b158af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/apps/hideo-files/app.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <karm-kira/scaffold.h>
#include <karm-kira/searchbar.h>
#include <karm-kira/side-nav.h>
#include <karm-ui/dialog.h>
#include <karm-ui/layout.h>
Expand Down Expand Up @@ -26,6 +27,7 @@ Ui::Child sidenavItem(State const &s, Mdi::Icon icon, String title, Mime::Url ur

Ui::Child sidebar(State const &s) {
return Kr::sidenav({
Kr::searchbar() | Ui::insets({6, 0}),
sidenavItem(s, Mdi::HOME, "Home"s, "location://home"_url),
sidenavItem(s, Mdi::FILE_DOCUMENT, "Documents"s, "location://documents"_url),
sidenavItem(s, Mdi::IMAGE, "Pictures"s, "location://pictures"_url),
Expand Down
2 changes: 2 additions & 0 deletions src/apps/hideo-settings/main/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <karm-kira/scaffold.h>
#include <karm-kira/searchbar.h>
#include <karm-kira/side-nav.h>
#include <karm-sys/entry.h>
#include <karm-ui/anim.h>
Expand Down Expand Up @@ -27,6 +28,7 @@ namespace Hideo::Settings {

Ui::Child sidebar(State const &state) {
Ui::Children items = {
Kr::searchbar() | Ui::insets({6, 0}),
Kr::sidenavItem(state.page() == Page::ACCOUNT, Model::bind<GoTo>(Page::ACCOUNT), Mdi::ACCOUNT, "Accounts"s),
Kr::sidenavItem(state.page() == Page::PERSONALIZATION, Model::bind<GoTo>(Page::PERSONALIZATION), Mdi::PALETTE, "Personalization"s),
Kr::sidenavItem(state.page() == Page::APPLICATIONS, Model::bind<GoTo>(Page::APPLICATIONS), Mdi::WIDGETS_OUTLINE, "Applications"s),
Expand Down
10 changes: 5 additions & 5 deletions src/libs/karm-kira/row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Ui::Child rowContent(Opt<Ui::Child> leading, String title, Opt<String> subtitle,
? *leading |
Ui::center() |
Ui::sizing(26, {Ui::UNCONSTRAINED, 26}) |
Ui::insets({ 0, 12, 0, 0})
Ui::insets({0, 12, 0, 0})
: Ui::empty();

auto t = subtitle
Expand All @@ -41,13 +41,13 @@ Ui::Child rowContent(Opt<Ui::Child> leading, String title, Opt<String> subtitle,
? *trailing |
Ui::center() |
Ui::sizing(26, {Ui::UNCONSTRAINED, 26}) |
Ui::insets({ 0, 12, 0, 0})
Ui::insets({0, 12, 0, 0})
: Ui::empty();

return minSize(
{Ui::UNCONSTRAINED, 48},
insets(
{12, 0},
{0, 12},
hflow(
0,
Math::Align::VCENTER | Math::Align::HFILL,
Expand All @@ -61,7 +61,7 @@ Ui::Child rowContent(Opt<Ui::Child> leading, String title, Opt<String> subtitle,

Ui::Child titleRow(String t) {
return Ui::titleMedium(t) |
Ui::insets({ 16, 12, 8, 12});
Ui::insets({16, 12, 8, 12});
}

Ui::Child pressableRow(Ui::OnPress onPress, Opt<Ui::Child> leading, String title, Opt<String> subtitle, Opt<Ui::Child> trailing) {
Expand Down Expand Up @@ -165,7 +165,7 @@ Ui::Child treeRow(Opt<Ui::Slot> leading, String title, Opt<String> subtitle, Ui:
)
),
state ? insets(
{ 0, 0, 0, 38},
{0, 0, 0, 38},
child()
) | slideIn(Ui::SlideFrom::TOP)
: Ui::empty()
Expand Down

0 comments on commit 3b158af

Please sign in to comment.