review: Move css out of js code

9533b7e59a9f626f1ca9ad48238ffc634ae99ea3

Joe <joenunezb@gmail.com>

3 files changed, +21 -25Ignore whitespace
public/css/scrollable-button.css+19 -0
@@ -0,0 +1,19 @@
1+.scrollable-buttons-container {
2+ max-height: 50vh; /* Use viewport height instead of fixed pixels */
3+ overflow-y: auto;
4+ -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */
5+ margin-top: 1rem; /* m-t-1 is equivalent to margin-top: 1rem; */
6+ flex-shrink: 1;
7+ min-height: 0;
8+ scrollbar-width: thin;
9+ scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
10+}
11+
12+.scrollable-buttons-container::-webkit-scrollbar {
13+ width: 6px;
14+}
15+
16+.scrollable-buttons-container::-webkit-scrollbar-thumb {
17+ background-color: rgba(255, 255, 255, 0.3);
18+ border-radius: 3px;
19+}
public/scripts/slash-commands.js+1 -25
@@ -2084,31 +2084,7 @@ async function buttonsCallback(args, text) {
20842084 buttonContainer.classList.add('flex-container', 'flexFlowColumn', 'wide100p');
20852085
20862086 const scrollableContainer = document.createElement('div');
2087- scrollableContainer.style.maxHeight = '50vh'; // Use viewport height instead of fixed pixels
2087+ scrollableContainer.classList.add('scrollable-buttons-container');
2088- scrollableContainer.style.overflowY = 'auto';
2089- scrollableContainer.style.WebkitOverflowScrolling = 'touch'; // Enable momentum scrolling on iOS
2090- scrollableContainer.classList.add('m-t-1', 'scrollable-buttons');
2091-
2092- // Add custom CSS for better mobile scrolling
2093- const style = document.createElement('style');
2094- style.textContent = `
2095- .scrollable-buttons {
2096- -webkit-overflow-scrolling: touch;
2097- overflow-y: auto;
2098- flex-shrink: 1;
2099- min-height: 0;
2100- scrollbar-width: thin;
2101- scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
2102- }
2103- .scrollable-buttons::-webkit-scrollbar {
2104- width: 6px;
2105- }
2106- .scrollable-buttons::-webkit-scrollbar-thumb {
2107- background-color: rgba(255, 255, 255, 0.3);
2108- border-radius: 3px;
2109- }
2110- `;
2111- document.head.appendChild(style);
21122088
21132089 for (const [result, button] of resultToButtonMap) {
21142090 const buttonElement = document.createElement('div');
public/style.css+1 -0
@@ -9,6 +9,7 @@
99@import url(css/logprobs.css);
1010@import url(css/accounts.css);
1111@import url(css/tags.css);
12+@import url(css/scrollable-button.css);
1213
1314:root {
1415 --doc-height: 100%;