Skip to content

Instantly share code, notes, and snippets.

View vincentnavetat's full-sized avatar
🐌

Vincent Navetat vincentnavetat

🐌
View GitHub Profile
@vincentnavetat
vincentnavetat / tooltip-web-component-position.js
Created September 27, 2019 14:23
Tooltip web component JS - responsive positioning
handleDropdownPosition() {
const screenPadding = 16;
const placeholderRect = this.placeholder.getBoundingClientRect();
const dropdownRect = this.dropdown.getBoundingClientRect();
const dropdownRightX = dropdownRect.x + dropdownRect.width;
const placeholderRightX = placeholderRect.x + placeholderRect.width;
if (dropdownRect.x < 0) {
@vincentnavetat
vincentnavetat / tooltip-web-component.js
Last active January 15, 2021 09:41
Tooltip web component JS
class Tooltip extends HTMLElement {
connectedCallback() {
this.setup();
}
toggle() {
if (this.classList.contains('tooltip--open')) {
this.close();
} else {
this.open();
@vincentnavetat
vincentnavetat / tooltip-web-component.css
Last active October 3, 2019 14:29
Tooltip web component CSS
@keyframes tooltipFadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@vincentnavetat
vincentnavetat / tooltip-web-component.html
Last active May 14, 2020 13:38
Tooltip web component HTML
<wow-tooltip class="tooltip">
<div class="tooltip__label" aria-describedby="tooltip-demo-content" data-tooltip-placeholder>
Here is a tooltip label
</div>
<div class="tooltip-dropdown" data-tooltip-dropdown>
<div role="tooltip" id="tooltip-demo-content" class="tooltip-dropdown__content">
It is a long established fact that a reader will be
<strong>distracted</strong>
by the readable content of a page when looking at its layout.
</div>
^D^D[⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [⠧] 🚀 [⠇] 🚀 [✔] 🚀
+-------------------------+---------+---------------------------+
| Used plugins |
+-------------------------+---------+---------------------------+
| Plugin | Version | Action |
+-------------------------+---------+---------------------------+
| fastlane-plugin-bugsnag | 1.4.1 | upload_symbols_to_bugsnag |
| | | send_build_to_bugsnag |
+-------------------------+---------+---------------------------+
@vincentnavetat
vincentnavetat / carousel-medium-small-screens.scss
Created January 12, 2018 15:52
Carousel component - Medium and small screen styles
@vincentnavetat
vincentnavetat / carousel-large-screens.scss
Last active January 12, 2018 15:52
Carousel component - Large screens styles
@vincentnavetat
vincentnavetat / carousel.html
Last active January 12, 2018 15:38
Carousel component - Partial