FIX: `Tooltip` styleguide triggers not rendering options (#29926)

Tooltips have different triggers / untriggers by device type (mobile / desktop) and this PR provides the correct options in the styleguide based on device type. 

# Before
<img width="787" alt="Screenshot 2024-11-25 at 3 31 56 PM" src="https://github.com/user-attachments/assets/f18f3003-e887-42c5-8f42-24af87cadf56">

# After
<img width="800" alt="Screenshot 2024-11-25 at 3 30 48 PM" src="https://github.com/user-attachments/assets/6113eff3-7b1f-4782-aea3-c8bee5e9842a">
This commit is contained in:
Isaac Janzen 2024-11-25 16:00:52 -06:00 committed by GitHub
parent 613dea61a2
commit 6aae60a212
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -8,10 +8,11 @@ import DummyComponent from "discourse/plugins/styleguide/discourse/components/du
export default class Tooltips extends Component { export default class Tooltips extends Component {
@service tooltip; @service tooltip;
@service site;
@tracked label = "What is this?"; @tracked label = "What is this?";
@tracked triggers = TOOLTIP.options.triggers; @tracked triggers = TOOLTIP.options.triggers[this.triggersByDevice];
@tracked untriggers = TOOLTIP.options.untriggers; @tracked untriggers = TOOLTIP.options.untriggers[this.triggersByDevice];
@tracked arrow = TOOLTIP.options.arrow; @tracked arrow = TOOLTIP.options.arrow;
@tracked inline = TOOLTIP.options.inline; @tracked inline = TOOLTIP.options.inline;
@tracked interactive = TOOLTIP.options.interactive; @tracked interactive = TOOLTIP.options.interactive;
@ -20,6 +21,10 @@ export default class Tooltips extends Component {
@tracked offset = TOOLTIP.options.offset; @tracked offset = TOOLTIP.options.offset;
@tracked _content = "Hello World!"; @tracked _content = "Hello World!";
get triggersByDevice() {
return this.site.mobileView ? "mobile" : "desktop";
}
get content() { get content() {
return this._content; return this._content;
} }