mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-08 18:42:27 -04:00
Redesign Modal
This commit is contained in:
+14
-3
@@ -4,12 +4,23 @@ namespace dusk::ui {
|
||||
|
||||
Modal::Modal(Props props)
|
||||
: WindowSmall("modal", "modal-dialog"), mProps(std::move(props)) {
|
||||
auto* title = append(mDialog, "div");
|
||||
title->SetClass("preset-title", true);
|
||||
auto* header = append(mDialog, "div");
|
||||
header->SetClass("modal-header", true);
|
||||
|
||||
auto* title = append(header, "div");
|
||||
title->SetClass("modal-title", true);
|
||||
title->SetInnerRML(mProps.title);
|
||||
|
||||
if (mProps.isWarning) {
|
||||
auto* icon = append(header, "icon");
|
||||
icon->SetClass("warning", true);
|
||||
} else if ( mProps.isError ) {
|
||||
auto* icon = append(header, "icon");
|
||||
icon->SetClass("error", true);
|
||||
}
|
||||
|
||||
auto* body = append(mDialog, "div");
|
||||
body->SetClass("preset-intro", true);
|
||||
body->SetClass("modal-body", true);
|
||||
body->SetInnerRML(mProps.bodyRml);
|
||||
|
||||
auto* actions = append(mDialog, "div");
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
Rml::String bodyRml;
|
||||
std::vector<ModalAction> actions;
|
||||
std::function<void(Modal&)> onDismiss;
|
||||
bool isWarning = false;
|
||||
bool isError = false;
|
||||
};
|
||||
|
||||
explicit Modal(Props props);
|
||||
|
||||
@@ -156,7 +156,7 @@ void try_push_verification_modal(Document& host) {
|
||||
modal.pop();
|
||||
};
|
||||
host.push(std::make_unique<Modal>(Modal::Props{
|
||||
.title = "Disc verification",
|
||||
.title = "Disc verification warning",
|
||||
.bodyRml = bodyRml,
|
||||
.actions =
|
||||
{
|
||||
@@ -170,12 +170,13 @@ void try_push_verification_modal(Document& host) {
|
||||
},
|
||||
},
|
||||
.onDismiss = dismiss,
|
||||
.isWarning = true,
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
host.push(std::make_unique<Modal>(Modal::Props{
|
||||
.title = "Disc verification",
|
||||
.title = "Disc verification error",
|
||||
.bodyRml = state.errorString,
|
||||
.actions =
|
||||
{
|
||||
@@ -185,6 +186,7 @@ void try_push_verification_modal(Document& host) {
|
||||
},
|
||||
},
|
||||
.onDismiss = dismiss,
|
||||
.isError = true,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user