Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8d3414

Browse files
Dan modal update (#1057)
1 parent008a107 commitf8d3414

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

‎pgml-dashboard/src/components/modal/mod.rs‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ pub struct Modal {
99
pubsize_class:String,
1010
pubheader:Option<Component>,
1111
pubbody:Component,
12+
pubdefault_style:bool,
1213
}
1314

1415
component!(Modal);
1516

1617
implModal{
1718
/// Create a new x-large modal with the given body.
1819
pubfnnew(body:Component) ->Self{
19-
let modal =Modal::default();
20+
let modal =Modal{
21+
default_style:true,
22+
..Modal::default()
23+
};
2024
let id =format!("modal-{}",crate::utils::random_string(10));
2125

2226
modal.id(&id).body(body).xlarge()
@@ -45,6 +49,20 @@ impl Modal {
4549
self.header =Some(header);
4650
self
4751
}
52+
53+
// Quick implimitation to toggle the modal
54+
pubfntoggle(id:&str) ->String{
55+
format!(r#"data-bs-toggle="modal" data-bs-target="{}{}""#,"#", id)
56+
}
57+
58+
pubfndismiss() ->String{
59+
r#"data-bs-dismiss="modal""#.into()
60+
}
61+
62+
pubfnno_default_style(mutself) ->Modal{
63+
self.default_style =false;
64+
self
65+
}
4866
}
4967

5068
#[cfg(test)]

‎pgml-dashboard/src/components/modal/modal.scss‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
.modal {
1+
div[data-controller="modal"].modal {
22
--bs-modal-margin:1.65rem;
33
--bs-modal-header-padding:0;
44
--bs-modal-width:75vw;
5+
--bs-modal-padding:40px;
56

67
@includemedia-breakpoint-up(lg) {
78
--bs-modal-width:40rem;
@@ -29,4 +30,17 @@
2930
width:100%;
3031
display:flex;
3132
}
33+
34+
.modal-body {
35+
margin-top:3rem;
36+
background-color:#{$gray-600};
37+
border:2pxsolid#{$gray-100};
38+
border-radius:$border-radius;
39+
justify-content:center;
40+
align-items:center;
41+
flex-direction:column;
42+
display:flex;
43+
width:100%;
44+
height:100%;
45+
}
3246
}

‎pgml-dashboard/src/components/modal/template.html‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
<divclass="modal <%- size_class %>"id="<%= id %>"data-controller="modal"tabindex="-1"aria-modal="true"role="dialog"data-modal-target="modal">
1+
<divclass="modal <%- size_class %>"id="<%= id %>"data-controller="modal"tabindex="-1"aria-modal="true"role="dialog"data-modal-target="modal">
22
<divclass="modal-dialog">
33
<divclass="modal-content">
44
<% if let Some(header) = header { %>
55
<divclass="modal-header">
66
<%+ header %>
77
</div>
88
<% } %>
9-
<divclass="modal-body">
10-
<divclass="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;">
11-
<%+ body %>
12-
</div>
9+
<div<% if default_style { %>class="modal-body"<% } %>>
10+
<%+ body %>
1311
</div>
1412
</div>
1513
</div>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp