Skip to content

Commit

Permalink
Fix tooltip bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Nov 23, 2020
1 parent 6398a01 commit c6eafbb
Show file tree
Hide file tree
Showing 16 changed files with 338 additions and 234 deletions.
24 changes: 0 additions & 24 deletions ACKNOWLEDGMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2223,30 +2223,6 @@ Signal Desktop makes use of the following open source projects.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## react-tooltip-lite

MIT License

Copyright (c) 2019 Benny Sidelinger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## react-virtualized

The MIT License (MIT)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"react-redux": "7.1.0",
"react-router-dom": "5.0.1",
"react-sortable-hoc": "1.9.1",
"react-tooltip-lite": "1.12.0",
"react-virtualized": "9.21.0",
"read-last-lines": "1.3.0",
"redux": "4.0.1",
Expand Down
60 changes: 0 additions & 60 deletions patches/react-tooltip-lite+1.12.0.patch

This file was deleted.

139 changes: 117 additions & 22 deletions stylesheets/_modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2782,24 +2782,34 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05',
}
}

.module-in-contacts-icon__tooltip {
.react-tooltip-lite {
span.module-in-contacts-icon__tooltip {
/* Written in this way to add more specificity and avoid !important */
.module-tooltip {
color: $color-white;
background-color: $ultramarine-ui-light;
}

.react-tooltip-lite-arrow {
border-color: $ultramarine-ui-light;
}
&[data-placement='top'] {
.module-tooltip-arrow::after {
border-top-color: $ultramarine-ui-light;
}
}

@include dark-theme {
.react-tooltip-lite {
color: $color-white;
background-color: $ultramarine-ui-light;
&[data-placement='right'] {
.module-tooltip-arrow::after {
border-right-color: $ultramarine-ui-light;
}
}

&[data-placement='bottom'] {
.module-tooltip-arrow::after {
border-bottom-color: $ultramarine-ui-light;
}
}

.react-tooltip-lite-arrow {
border-color: $ultramarine-ui-light;
&[data-placement='left'] {
.module-tooltip-arrow::after {
border-left-color: $ultramarine-ui-light;
}
}
}
}
Expand Down Expand Up @@ -6522,8 +6532,8 @@ button.module-image__border-overlay:focus {
margin-top: 54px;
overflow: scroll;
padding: 14px;
padding-bottom: 0;
width: 280px;
padding-bottom: 0;

&__overlay {
display: flex;
Expand Down Expand Up @@ -10183,10 +10193,13 @@ $contact-modal-padding: 18px;
}
}

/* Third-party module: react-tooltip-lite */

.react-tooltip-lite {
.module-tooltip {
border-radius: 8px;
display: inline-block;
padding: 8px 21px;
position: fixed;
text-align: center;
z-index: 999;

@include light-theme {
background-color: $color-gray-02;
Expand All @@ -10196,14 +10209,96 @@ $contact-modal-padding: 18px;
background-color: $color-gray-65;
color: $color-gray-05;
}
}

.react-tooltip-lite-arrow {
@include light-theme {
border-color: $color-gray-02;
.module-tooltip-arrow {
position: absolute;
}
@include dark-theme {
border-color: $color-gray-65;

.module-tooltip-arrow::after {
border: solid 6px transparent;
content: '';
display: block;
height: 0;
margin-left: -6px;
margin-top: -6px;
position: absolute;
width: 0;
}

&[data-placement='top'] {
margin-bottom: 12px;

.module-tooltip-arrow {
bottom: 0;
}

.module-tooltip-arrow::after {
bottom: -12px;

@include light-theme {
border-top-color: $color-gray-02;
}
@include dark-theme {
border-top-color: $color-gray-65;
}
}
}

&[data-placement='right'] {
margin-left: 12px;

.module-tooltip-arrow {
left: 0;
}

.module-tooltip-arrow::after {
left: -6px;

@include light-theme {
border-right-color: $color-gray-02;
}
@include dark-theme {
border-right-color: $color-gray-65;
}
}
}

&[data-placement='bottom'] {
margin-top: 12px;

.module-tooltip-arrow {
top: 0;
}

.module-tooltip-arrow::after {
top: -6px;

@include light-theme {
border-bottom-color: $color-gray-02;
}
@include dark-theme {
border-bottom-color: $color-gray-65;
}
}
}

&[data-placement='left'] {
margin-right: 12px;

.module-tooltip-arrow {
right: 0;
}

.module-tooltip-arrow::after {
right: -12px;

@include light-theme {
border-left-color: $color-gray-02;
}
@include dark-theme {
border-left-color: $color-gray-65;
}
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions ts/components/CallScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,18 @@ export const CallScreen: React.FC<PropsType> = ({
buttonType={videoButtonType}
i18n={i18n}
onClick={toggleVideo}
tooltipDistance={24}
/>
<CallingButton
buttonType={audioButtonType}
i18n={i18n}
onClick={toggleAudio}
tooltipDistance={24}
/>
<CallingButton
buttonType={CallingButtonType.HANG_UP}
i18n={i18n}
onClick={() => {
hangUp({ conversationId: conversation.id });
}}
tooltipDistance={24}
/>
</div>
<div
Expand Down
20 changes: 6 additions & 14 deletions ts/components/CallingButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@

import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { number, select } from '@storybook/addon-knobs';
import { select } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';

import {
CallingButton,
CallingButtonType,
PropsType,
TooltipDirection,
} from './CallingButton';
import { CallingButton, CallingButtonType, PropsType } from './CallingButton';
import { TooltipPlacement } from './Tooltip';
import { setup as setupI18n } from '../../js/modules/i18n';
import enMessages from '../../_locales/en/messages.json';

Expand All @@ -27,12 +23,8 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
onClick: action('on-click'),
tooltipDirection: select(
'tooltipDirection',
TooltipDirection,
overrideProps.tooltipDirection || TooltipDirection.DOWN
),
tooltipDistance: number(
'tooltipDistance',
overrideProps.tooltipDistance || 16
TooltipPlacement,
overrideProps.tooltipDirection || TooltipPlacement.Bottom
),
});

Expand Down Expand Up @@ -87,7 +79,7 @@ story.add('Video Disabled', () => {

story.add('Tooltip right', () => {
const props = createProps({
tooltipDirection: TooltipDirection.RIGHT,
tooltipDirection: TooltipPlacement.Right,
});
return <CallingButton {...props} />;
});
Loading

0 comments on commit c6eafbb

Please sign in to comment.