Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

[spike] remove callout component #372

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Binary file not shown.
7 changes: 0 additions & 7 deletions src/components/Callout/Callout.css

This file was deleted.

40 changes: 0 additions & 40 deletions src/components/Callout/Callout.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/Callout/Callout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/Callout/index.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/components/Hovercard/Hovercard.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */
import { memoizeFunction } from '@uifabric/utilities';
import { borderStylePopOver } from '../../util/styles/borders';

export const getCalloutStyles = memoizeFunction(() => () => ({
root: borderStylePopOver,
}));
2 changes: 1 addition & 1 deletion src/components/Hovercard/Hovercard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */
import * as React from 'react';
import { mount, ReactWrapper, shallow, ShallowWrapper } from 'enzyme';
import Callout from '../Callout';
import { Callout } from 'office-ui-fabric-react/lib/Callout';
import { KeyCodes } from '../../util/keyCodes';
import { Hovercard, HovercardProps, HovercardState, TriggerType } from '.';

Expand Down
4 changes: 3 additions & 1 deletion src/components/Hovercard/Hovercard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import '../../yamui';
import * as React from 'react';
import { join } from '../../util/classNames';
import Callout, { DirectionalHint } from '../Callout';
import { Callout, DirectionalHint } from 'office-ui-fabric-react/lib/Callout';
import { NestableBaseComponentProps } from '../../util/BaseComponent/props';
import { KeyCodes } from '../../util/keyCodes';
import ScreenreaderText from '../ScreenreaderText';
import { getCalloutStyles } from './Hovercard.styles';
import './Hovercard.css';

const hideDelay = 500;
Expand Down Expand Up @@ -111,6 +112,7 @@ export default class Hovercard extends React.Component<HovercardProps, Hovercard
target={this.triggerElement}
onDismiss={this.hide}
preventDismissOnScroll={false}
styles={getCalloutStyles()}
>
<div className="y-hovercard--modal-container" onMouseEnter={this.handleBodyHover} onMouseLeave={this.beginHide}>
{screenreaderTitleChild}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ exports[`<Hovercard /> with screenreaderTitle matches its snapshot 1`] = `
isBeakVisible={true}
onDismiss={[Function]}
preventDismissOnScroll={false}
styles={[Function]}
target={null}
>
<div
Expand Down
7 changes: 4 additions & 3 deletions src/components/Tooltip/Tooltip.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { palette } from '../../util/colors';
import { TooltipProps } from './Tooltip';
import { lineHeights, fontSizes } from '../../util/styles/fonts';
import { borderRadiusSoft } from '../../util/styles/borders';
import { borderRadiusSoft, borderStylePopOver } from '../../util/styles/borders';

import { ITooltipStyles } from 'office-ui-fabric-react/lib/components/Tooltip/Tooltip.types';
import { ICalloutContentStyles } from 'office-ui-fabric-react/lib/components/Callout/Callout.types';
Expand Down Expand Up @@ -30,20 +30,21 @@ export const getCalloutStyles = (_: TooltipProps): ICalloutContentStyles => {
},
root: {
backgroundColor: 'inherit',
boxShadow: 'none',
padding: '0.7rem 1.2rem 0.8rem',
minHeight: '3.2rem',
zIndex: 1000,
border: 'none',
...borderStylePopOver,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Find out if tooltip should have this style.

},
beak: {
backgroundColor: palette.neutralPrimary,
},
beakCurtain: {
boxShadow: 'none',
backgroundColor: palette.neutralPrimary,
borderRadius: borderRadiusSoft,
},
calloutMain: {
boxShadow: 'none',
backgroundColor: palette.neutralPrimary,
},
};
Expand Down
18 changes: 15 additions & 3 deletions src/components/Tooltip/__snapshots__/Tooltip.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ exports[`<Tooltip /> with additional className matches its snapshot 1`] = `
"beakCurtain": Object {
"backgroundColor": "#343A41",
"borderRadius": "2px",
"boxShadow": "none",
},
"calloutMain": Object {
"backgroundColor": "#343A41",
"boxShadow": "none",
},
"container": Object {
"backgroundColor": "inherit",
},
"root": Object {
"backgroundColor": "inherit",
"border": "none",
"boxShadow": "none",
"borderRadius": "1px",
"borderWidth": 0,
"boxShadow": "0 0 12px rgba(0, 0, 0, 0.2)",
"minHeight": "3.2rem",
"padding": "0.7rem 1.2rem 0.8rem",
"zIndex": 1000,
Expand Down Expand Up @@ -65,17 +69,21 @@ exports[`<Tooltip /> with default options matches its snapshot 1`] = `
"beakCurtain": Object {
"backgroundColor": "#343A41",
"borderRadius": "2px",
"boxShadow": "none",
},
"calloutMain": Object {
"backgroundColor": "#343A41",
"boxShadow": "none",
},
"container": Object {
"backgroundColor": "inherit",
},
"root": Object {
"backgroundColor": "inherit",
"border": "none",
"boxShadow": "none",
"borderRadius": "1px",
"borderWidth": 0,
"boxShadow": "0 0 12px rgba(0, 0, 0, 0.2)",
"minHeight": "3.2rem",
"padding": "0.7rem 1.2rem 0.8rem",
"zIndex": 1000,
Expand Down Expand Up @@ -120,17 +128,21 @@ exports[`<Tooltip /> with directionalHint matches its snapshot 1`] = `
"beakCurtain": Object {
"backgroundColor": "#343A41",
"borderRadius": "2px",
"boxShadow": "none",
},
"calloutMain": Object {
"backgroundColor": "#343A41",
"boxShadow": "none",
},
"container": Object {
"backgroundColor": "inherit",
},
"root": Object {
"backgroundColor": "inherit",
"border": "none",
"boxShadow": "none",
"borderRadius": "1px",
"borderWidth": 0,
"boxShadow": "0 0 12px rgba(0, 0, 0, 0.2)",
"minHeight": "3.2rem",
"padding": "0.7rem 1.2rem 0.8rem",
"zIndex": 1000,
Expand Down
6 changes: 6 additions & 0 deletions src/util/styles/borders.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */
export const borderRadiusSoft = '2px';
export const borderRadiusRound = '50%';
export const borderStylePopOver = {
boxShadow: '0 0 12px rgba(0, 0, 0, 0.2)',
border: 'none',
borderRadius: '1px',
borderWidth: 0,
};