Skip to content

Commit

Permalink
tooltip now displays to the right with bottom as a fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Jul 18, 2024
1 parent 62386cb commit e875602
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
6 changes: 5 additions & 1 deletion packages/ilios-common/addon/components/ics-feed.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<FaIcon @icon="square-rss" />
</CopyButton>
{{#if (and this.copyButton this.showTooltip)}}
<IliosTooltip @target={{this.copyButton}}>
<IliosTooltip
@target={{this.copyButton}}
@options={{this.popperOptions}}
class="ics-feed-tooltip"
>
{{t "general.copyIcsFeedUrl"}}
</IliosTooltip>
{{/if}}
Expand Down
12 changes: 12 additions & 0 deletions packages/ilios-common/addon/components/ics-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ export default class IcsFeedComponent extends Component {
textCopied = restartableTask(async () => {
this.flashMessages.success('general.copiedIcsFeedUrl');
});

popperOptions = {
placement: 'right',
modifiers: [
{
name: 'flip',
options: {
fallbackPlacements: ['bottom'],
},
},
],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,3 @@
}
}
}

// tooltips are outside the document flow so have to be styled outside the component
.ics-feed-display-success-message-tooltip {
padding: 0;
&.ilios-tooltip .content {
max-width: 100%;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@
right: -4px;
}

&[data-popper-placement^="right"] {
padding-left: 0;
padding-right: 0;
}

&[data-popper-placement^="right"] .arrow {
left: -4px;
}
}

// tooltips are outside the document flow so have to be styled outside the component
.ilios-tooltip.ics-feed-tooltip .content {
max-width: 100%;
}

0 comments on commit e875602

Please sign in to comment.