Skip to content

Commit

Permalink
fix(slack): Add button wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
izontm committed May 27, 2024
1 parent 13206d8 commit 82306be
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/content/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

const getTextContent = (element) => element ? element.textContent.trim() : '';

const getWorkspaceName = () => getTextContent($('.p-ia__sidebar_header__team_name_text'));
const getWorkspaceName = () => getTextContent($('.p-ia4_home_header_menu__team_name'));

togglbutton.render('.p-view_header:not(.toggl)', { observe: true }, (elem) => {
togglbutton.render('.p-view_header__actions:not(.toggl)', { observe: true }, (elem) => {
const description = $('[data-qa="channel_name"]');
const isRendered = $('.toggl-button', elem) != null;

Expand All @@ -25,7 +25,12 @@ togglbutton.render('.p-view_header:not(.toggl)', { observe: true }, (elem) => {
buttonType: 'minimal'
});

elem.insertBefore(link, elem.lastChild);
const button = document.createElement('button');

button.className = 'c-button-unstyled c-icon_button c-icon_button--size_medium p-toggle_channel_space_action_button display_flex align_items_center p-toggle_channel_space_action_button--text p-toggle_channel_space_action--overlay c-icon_button--default';
button.appendChild(link);

elem.insertBefore(button, elem.firstChild);
});

togglbutton.render('.c-message_kit__hover:not(.toggl)', { observe: true }, elem => {
Expand All @@ -47,8 +52,6 @@ togglbutton.render('.c-message_kit__hover:not(.toggl)', { observe: true }, elem
});

const button = document.createElement('button');
const buttonContainer = document.createElement('span');
buttonContainer.className = 'slack-message-container';

button.className = 'c-button-unstyled c-icon_button c-icon_button--light c-icon_button--size_small c-message_actions__button';
button.setAttribute('type', 'button');
Expand Down
14 changes: 12 additions & 2 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -920,14 +920,24 @@ li > .toggl-button.phabricator {
/********* SLACK *********/
.toggl-button.slack-message:not(.toggl-button-edit-form-button) {
position: relative;
top: 2px;
top: 1px;
width: 16px;
height: 16px;
height: 17px;
padding-left: 0;
background-size: 100%;
background-position: center bottom;
}

.toggl .p-toggle_channel_space_action_button {
margin-right: 8px;
}

.toggl-button.slack.min {
width: 18px;
height: 18px;
margin-top: 2px;
}

.slack-message-container {
position: relative;
display: inline-flex;
Expand Down

0 comments on commit 82306be

Please sign in to comment.