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

Commit3dd9e7f

Browse files
authored
Tooltip (#1429)
1 parent656a1a7 commit3dd9e7f

File tree

13 files changed

+124
-18
lines changed

13 files changed

+124
-18
lines changed

‎pgml-dashboard/src/components/chatbot/chatbot_controller.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,13 @@ export default class extends Controller {
400400

401401
showChatbotAlert(level,message){
402402
consttoastElement=createToast(message,level);
403-
showToast(toastElement,{
404-
autohide:true,
405-
delay:7000,
406-
});
403+
404+
if(toastElement){
405+
showToast(toastElement,{
406+
autohide:true,
407+
delay:7000,
408+
});
409+
}
407410
}
408411

409412
hideExampleQuestions(){
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This file is automatically generated.
2+
// You shouldn't modify it manually.
3+
4+
// src/components/inputs/labels/with_tooltip
5+
pubmod with_tooltip;
6+
pubuse with_tooltip::WithTooltip;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
use pgml_components::{component,Component};
2+
use sailfish::TemplateOnce;
3+
4+
#[derive(TemplateOnce,Default)]
5+
#[template(path ="inputs/labels/with_tooltip/template.html")]
6+
pubstructWithTooltip{
7+
component:Component,
8+
tooltip:String,
9+
icon:String,
10+
html:bool,
11+
}
12+
13+
implWithTooltip{
14+
pubfnnew(component:Component) ->WithTooltip{
15+
WithTooltip{
16+
component,
17+
tooltip:String::new(),
18+
icon:"info".to_string(),
19+
html:false,
20+
}
21+
}
22+
23+
pubfntooltip(mutself,tooltip:implToString) ->Self{
24+
self.tooltip = tooltip.to_string();
25+
self
26+
}
27+
28+
pubfntooltip_text(self,tooltip:implToString) ->Self{
29+
self.tooltip(tooltip)
30+
}
31+
32+
pubfntooltip_html(mutself,tooltip:implToString) ->Self{
33+
self.tooltip = tooltip.to_string();
34+
self.html =true;
35+
self
36+
}
37+
38+
pubfnicon(mutself,icon:implToString) ->Self{
39+
self.icon = icon.to_string();
40+
self
41+
}
42+
}
43+
44+
component!(WithTooltip);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<span
2+
data-controller="inputs-labels-with-tooltip enable-tooltip"
3+
class="d-inline-flex gap-1 align-items-top"
4+
>
5+
<span><%+ component %></span>
6+
<span
7+
data-bs-toggle="tooltip"
8+
data-bs-placement="right"
9+
data-bs-title="<%- tooltip %>"
10+
data-bs-html="<%= html %>"
11+
class="material-symbols-outlined fw-bold"
12+
>
13+
<%= icon %>
14+
</span>
15+
</span>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
span[data-controller="inputs-labels-with-tooltip enable-tooltip"] {
2+
span[data-bs-toggle="tooltip"] {
3+
color:#{$slate-tint-100};
4+
font-size:1.2rem;
5+
}
6+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
pubmod checkbox;
66
pubuse checkbox::Checkbox;
77

8+
// src/components/inputs/labels
9+
pubmod labels;
10+
811
// src/components/inputs/radio
912
pubmod radio;
1013
pubuse radio::Radio;

‎pgml-dashboard/src/components/inputs/text/input/input.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
div[data-controller="inputs-text-input"] {
22
--bs-danger:#{$peach-shade-100};
33

4-
span.material-symbols-outlined{
4+
span.inputs-text-input-icon{
55
margin-left:-40px;
66
color:#{$slate-shade-100};
77

‎pgml-dashboard/src/components/inputs/text/input/template.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<% if let Some(icon) = icon { %>
2828
<span
29-
class="<%= icon_classes %>"
29+
class="<%= icon_classes %> inputs-text-input-icon"
3030
data-action="<%= icon_actions %>">
3131
<%= icon %>
3232
</span>

‎pgml-dashboard/src/components/pages/demo/template.html‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<% use crate::components::inputs::select::{Select, Option}; %>
99
<% use crate::components::inputs::{SwitchV2, Radio, Checkbox}; %>
1010
<% use crate::components::cards::{Rgb, Secondary, Primary}; %>
11+
<% use crate::components::inputs::labels::WithTooltip; %>
1112

1213
<divclass="container"data-controller="pages-demo">
1314
<divclass="py-5">
@@ -59,8 +60,14 @@
5960
</div>
6061

6162
<divclass="py-5">
63+
<%
64+
let label = WithTooltip::new("Name".into())
65+
.tooltip("Your full name.")
66+
.icon("info");
67+
%>
68+
6269
<%+ Input::new()
63-
.label("What is your name?".into())
70+
.label(label.into())
6471
.icon("person")
6572
.placeholder("Enter your name")
6673
.name("name")
@@ -201,4 +208,16 @@
201208
</div>
202209
</div>
203210
</div>
211+
212+
<divclass="py-5">
213+
<%+ WithTooltip::new("Model".into())
214+
.tooltip("A model is great, but two is better.")
215+
.icon("help_outline") %>
216+
</div>
217+
218+
<divclass="py-5">
219+
<%+ WithTooltip::new("Model".into())
220+
.tooltip_html("A model is great<br>, but<br> two<br> is better.")
221+
.icon("help_outline") %>
222+
</div>
204223
</div>

‎pgml-dashboard/static/css/modules.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@import"../../src/components/icons/checkmark/checkmark.scss";
2222
@import"../../src/components/icons/twitter/twitter.scss";
2323
@import"../../src/components/inputs/checkbox/checkbox.scss";
24+
@import"../../src/components/inputs/labels/with_tooltip/with_tooltip.scss";
2425
@import"../../src/components/inputs/radio/radio.scss";
2526
@import"../../src/components/inputs/range_group/range_group.scss";
2627
@import"../../src/components/inputs/range_group_v_2/range_group_v_2.scss";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp