Skip to content

Commit

Permalink
Update GIF button not displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
N1ck committed Jan 6, 2024
1 parent 009c81d commit 94ff64d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/giphy-toolbar-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import React from 'dom-chef'

export default (
<details class="details-reset details-overlay toolbar-item select-menu select-menu-modal-right ghg-trigger btn-octicon">
<details class=" details-reset details-overlay toolbar-item select-menu select-menu-modal-right ghg-trigger">
<summary
class="menu-target p-2 p-md-1 mx-1"
class="menu-target Button Button--iconOnly Button--invisible Button--medium"
aria-label="Insert a GIF"
aria-haspopup="menu"
>
Expand Down
12 changes: 11 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function addToolbarButton() {
const form = toolbar.closest('form')

const reviewChangesModal = toolbar.closest(

Check failure on line 82 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Replace `⏎······'#review-changes-modal'⏎····` with `'#review-changes-modal'`
'#review-changes-modal .SelectMenu-modal'
'#review-changes-modal'
)
const reviewChangesList = toolbar.closest(
'#review-changes-modal .SelectMenu-list'
Expand All @@ -90,6 +90,16 @@ function addToolbarButton() {
// Otherwise the GIF selection popover will not be visible.
if (reviewChangesModal !== null) {
reviewChangesModal.classList.add('ghg-in-review-changes-modal')

// The Review changes modal sets an inline width of min(640px, 100vw - 2rem);
// our button takes up another 32px so we need to adjust the inline style to account for that, otherwise it's hidden.
let currentWidth = reviewChangesModal.style.width;

Check failure on line 96 in src/main.js

View workflow job for this annotation

GitHub Actions / test

'currentWidth' is never reassigned. Use 'const' instead.

Check failure on line 96 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Delete `;`
if (currentWidth.includes('px')) {
// Extracts the value from the string (e.g., 640 from "min(640px, 100vw - 2rem)")

Check failure on line 98 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Delete `··`
let widthValue = parseInt(currentWidth.match(/\d+/)[0]);

Check failure on line 99 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Replace `··········let·widthValue·=·parseInt(currentWidth.match(/\d+/)[0]);` with `········let·widthValue·=·parseInt(currentWidth.match(/\d+/)[0])`

Check failure on line 99 in src/main.js

View workflow job for this annotation

GitHub Actions / test

'widthValue' is never reassigned. Use 'const' instead.

Check failure on line 99 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Prefer `Number.parseInt()` over `parseInt()`.

Check failure on line 99 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Missing radix parameter.
let modifiedWidth = currentWidth.replace(widthValue + 'px', `${widthValue + 32}px`);

Check failure on line 100 in src/main.js

View workflow job for this annotation

GitHub Actions / test

Replace `··········let·modifiedWidth·=·currentWidth.replace(widthValue·+·'px',·`${widthValue·+·32}px`);` with `········let·modifiedWidth·=·currentWidth.replace(⏎··········widthValue·+·'px',⏎··········`${widthValue·+·32}px``

Check failure on line 100 in src/main.js

View workflow job for this annotation

GitHub Actions / test

'modifiedWidth' is never reassigned. Use 'const' instead.
reviewChangesModal.style.width = modifiedWidth;
}
}

if (reviewChangesList !== null) {
Expand Down
2 changes: 0 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
}

.ghg-in-review-changes-modal {
/* Fixes the GIF button dropping to a new line in the review modal */
width: 678px !important;
/* Fixes the GIF dropdown being hidden by the review modal's overflow */
overflow: unset !important;
}
Expand Down

0 comments on commit 94ff64d

Please sign in to comment.