Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Mm 29656 #7820

Merged
merged 8 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions components/product_notices_modal/product_notices.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
import React from 'react';
import {shallow} from 'enzyme';

import {trackEvent} from 'actions/telemetry_actions.jsx';

import GenericModal from 'components/generic_modal';
import {isDesktopApp, getDesktopVersion} from 'utils/user_agent';

import ProductNoticesModal from './product_notices_modal';

jest.mock('utils/user_agent');
jest.mock('actions/telemetry_actions.jsx', () => {
const original = jest.requireActual('actions/telemetry_actions.jsx');
return {
...original,
trackEvent: jest.fn(),
};
});

describe('ProductNoticesModal', () => {
const noticesData = [{
Expand Down Expand Up @@ -108,7 +99,6 @@ describe('ProductNoticesModal', () => {
await baseProps.actions.getInProductNotices();
wrapper.setState({noticesData: [noticesData[1]]});
wrapper.find(GenericModal).prop('handleConfirm')?.();
expect(trackEvent).toHaveBeenCalledWith('ui', 'notice_click_123');
expect(window.open).toHaveBeenCalledWith(noticesData[1].actionParam, '_blank');
});

Expand Down Expand Up @@ -183,11 +173,4 @@ describe('ProductNoticesModal', () => {

expect(baseProps.actions.getInProductNotices).toHaveBeenCalledTimes(1);
});

test('Should call for trackEvent on click of action button', async () => {
const wrapper = shallow(<ProductNoticesModal {...baseProps}/>);
await baseProps.actions.getInProductNotices();
wrapper.find('.actionButton').simulate('click');
expect(trackEvent).toHaveBeenCalledWith('ui', 'notice_click_124');
});
});
95 changes: 77 additions & 18 deletions components/product_notices_modal/product_notices_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
}

.GenericModal__header {
padding: 0px;
padding: 0;
}

.GenericModal__body {
padding: 0px;
padding: 0;
}

.productNotices__helpText {
Expand All @@ -23,11 +23,11 @@
border: 1px solid var(--center-channel-color-16);
border-radius: 4px;
max-height: 347px;
margin: 20px auto 0px;
margin: 20px auto 0;
display: block;
}
.productNotices__imageDiv {
margin: 0px auto;
margin: 0 auto;
}

.modal-footer {
Expand Down Expand Up @@ -60,26 +60,85 @@

&.GenericModal .modal-footer {
position: relative;
padding: 0px;
padding: 0;
}
.GenericModal__button {
padding: 10px 16px;
span {
font-size: 12px;
line-height: 9px;
display: inline-flex;
align-items: center;
border: none;
padding: 13px 20px;
font-size: 14px;
line-height: 14px;

&.confirm {
background: var(--button-bg);
color: var(--button-color);

&:hover:not(.disabled) {
background: linear-gradient(
0deg,
rgba(var(--center-channel-color-rgb), 0.16),
rgba(var(--center-channel-color-rgb), 0.16)
),
var(--button-bg);
}

&:active {
background: linear-gradient(
0deg,
rgba(var(--center-channel-color-rgb), 0.32),
rgba(var(--center-channel-color-rgb), 0.32)
),
var(--button-bg);
}

&:focus {
box-shadow: inset 0 0 0 2px var(--sidebar-text-active-border);
}
}

&.cancel,
&.actionButton {
border-width: 2px;
border-color: rgb(35, 137, 215);
border: 1px solid var(--sys-button-bg);
border-radius: 4px;
display: inline-block;
display: inline-flex;
align-items: center;
color: var(--button-bg);
background: var(--center-channel-bg);
text-decoration: none;

&:hover {
background: rgba(var(--button-bg-rgb), 0.04);
}

&:active {
background: rgba(var(--button-bg-rgb), 0.08);
}

&:focus {
box-shadow: inset 0 0 0 2px var(--sidebar-text-active-border);
}
}
}

.fa {
width: 14px;
font-size: 14px;
margin-left: 5px;
&.actionButton {
box-shadow: inset 0 0 0 1px var(--button-bg);
}

&.cancel {
margin-right: 12px;
}

.fa {
font-size: 14px;

// only target `.fa` that is the first child (left aligned icon)
&:first-child {
margin-right: 7px;
}
}

// only target `.fa` that follows a `span` (right aligned icon)
span ~ .fa {
margin-left: 7px;
}
}
}