Skip to content

Commit

Permalink
Swap bootstrap with tippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchdev committed Dec 5, 2023
1 parent 19f0f8d commit a42e6b8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
},
rules: {
'class-methods-use-this': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-param-reassign': ['error', { props: false }],
'prefer-destructuring': ['error', { object: true, array: false }],
Expand Down
13 changes: 12 additions & 1 deletion assets/chat/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import '../../common';
@import '../../icons/icons';
@import '~normalize.css';
@import '~bootstrap';
@import '~tippy.js/dist/tippy.css';
@import '~tippy.js/dist/svg-arrow.css';
@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,600,700');

*,
Expand Down Expand Up @@ -2180,3 +2181,13 @@ body.pref-fontscale[data-fontscale='10'] {
font-family: 'Among Us';
src: url('../../../fonts/AmongUs-Regular.ttf') format('truetype');
}

.tippy-box[data-theme~='dgg'] {
text-align: center;
background-color: white;
color: #000;
}

.tippy-box[data-theme~='dgg'] > .tippy-svg-arrow {
fill: white;
}
13 changes: 10 additions & 3 deletions assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fetch } from 'whatwg-fetch';
import $ from 'jquery';
import { debounce } from 'throttle-debounce';
import moment from 'moment';
import { Tooltip } from 'bootstrap';
import tippy, { roundArrow } from 'tippy.js';
import {
KEYCODES,
DATE_FORMATS,
Expand Down Expand Up @@ -267,8 +267,15 @@ class Chat {
return link.sheet;
})();

const tooltipList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
tooltipList.forEach((el) => new Tooltip(el));
// Tooltips
tippy('[data-tippy-content]', {
arrow: roundArrow,
delay: 0,
duration: 0,
maxWidth: 250,
hideOnClick: false,
theme: 'dgg',
});

this.ishidden = (document.visibilityState || 'visible') !== 'visible';
this.output = this.ui.find('#chat-output-frame');
Expand Down
1 change: 0 additions & 1 deletion assets/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ switch ((Chat.reqParam('t') || 'embed').toUpperCase()) {

case 'EMBED':
default:
html.attr('data-bs-theme', 'dark');
chat
.withGui(embedHtml)
.then(() => chat.loadEmotesAndFlairs())
Expand Down
4 changes: 1 addition & 3 deletions assets/views/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
<a
id="chat-watching-focus-btn"
class="chat-tool-btn"
title="Highlights messages from users watching the same stream"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-tippy-content="Highlights messages from users watching the same stream"
>
<i class="btn-icon"></i>
</a>
Expand Down
50 changes: 18 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"overlayscrollbars": "^2.0.3",
"sass-loader": "^13.2.0",
"throttle-debounce": "~5.0.0",
"tippy.js": "^6.3.7",
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
Expand All @@ -48,7 +49,6 @@
"@babel/preset-env": "^7.14.2",
"autoprefixer": "^10.2.5",
"babel-loader": "^9.1.2",
"bootstrap": "^5.3.2",
"css-loader": "^6.7.3",
"eslint": "^8.27.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down

0 comments on commit a42e6b8

Please sign in to comment.