Content-Length: 364709 | pFad | http://github.com/postgresml/postgresml/pull/1057/files

67 Dan modal update by chillenberger · Pull Request #1057 · postgresml/postgresml · GitHub
Skip to content

Dan modal update #1057

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

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion pgml-dashboard/src/components/modal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ pub struct Modal {
pub size_class: String,
pub header: Option<Component>,
pub body: Component,
pub default_style: bool,
}

component!(Modal);

impl Modal {
//github.com/ Create a new x-large modal with the given body.
pub fn new(body: Component) -> Self {
let modal = Modal::default();
let modal = Modal {
default_style: true,
..Modal::default()
};
let id = format!("modal-{}", crate::utils::random_string(10));

modal.id(&id).body(body).xlarge()
Expand Down Expand Up @@ -45,6 +49,20 @@ impl Modal {
self.header = Some(header);
self
}

// Quick implimitation to toggle the modal
pub fn toggle(id: &str) -> String {
format!(r#"data-bs-toggle="modal" data-bs-target="{}{}""#, "#", id)
}

pub fn dismiss() -> String {
r#"data-bs-dismiss="modal""#.into()
}

pub fn no_default_style(mut self) -> Modal {
self.default_style = false;
self
}
}

#[cfg(test)]
Expand Down
16 changes: 15 additions & 1 deletion pgml-dashboard/src/components/modal/modal.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.modal {
div[data-controller="modal"].modal {
--bs-modal-margin: 1.65rem;
--bs-modal-header-padding: 0;
--bs-modal-width: 75vw;
--bs-modal-padding: 40px;

@include media-breakpoint-up(lg) {
--bs-modal-width: 40rem;
Expand Down Expand Up @@ -29,4 +30,17 @@
width: 100%;
display: flex;
}

.modal-body {
margin-top: 3rem;
background-color: #{$gray-600};
border: 2px solid #{$gray-100};
border-radius: $border-radius;
justify-content: center;
align-items: center;
flex-direction: column;
display: flex;
width: 100%;
height: 100%;
}
}
8 changes: 3 additions & 5 deletions pgml-dashboard/src/components/modal/template.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<div class="modal <%- size_class %>" id="<%= id %>" data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal">
<div class="modal <%- size_class %>" id="<%= id %>" data-controller="modal" tabindex="-1" aria-modal="true" role="dialog" data-modal-target="modal" >
<div class="modal-dialog">
<div class="modal-content">
<% if let Some(header) = header { %>
<div class="modal-header">
<%+ header %>
</div>
<% } %>
<div class="modal-body">
<div class="w-100 h-100 mt-5 py-5 px-3 d-flex flex-column justify-content-center align-items-center" style="background: black; border: 2px solid white; border-radius: 12px;">
<%+ body %>
</div>
<div <% if default_style { %>class="modal-body" <% } %>>
<%+ body %>
</div>
</div>
</div>
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgresml/postgresml/pull/1057/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy