-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- render name when we have it in the dm response
- Loading branch information
Showing
10 changed files
with
332 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
$font-size-small: 12px; | ||
$font-size-medium: 14px; | ||
$font-size-large: 16px; | ||
$font-size-xl: 20px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Tooltip, { Properties } from './'; | ||
import { default as ReactTooltip } from 'rc-tooltip'; | ||
|
||
const OVERLAY_TEST = 'overlay-test'; | ||
const CHILDREN_TEST = 'children'; | ||
|
||
describe('Tooltip', () => { | ||
const subject = (props: Partial<Properties>) => { | ||
const allProps: Properties = { | ||
overlay: OVERLAY_TEST, | ||
...props, | ||
}; | ||
|
||
return shallow( | ||
<Tooltip {...allProps}> | ||
<>{CHILDREN_TEST}</> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
it('render', function () { | ||
const wrapper = subject({}); | ||
|
||
expect(wrapper.find(ReactTooltip).exists()).toBe(true); | ||
}); | ||
|
||
it('renders all props', function () { | ||
const wrapper = subject({}); | ||
|
||
expect(wrapper.find(ReactTooltip).props()).toEqual({ | ||
children: <React.Fragment>children</React.Fragment>, | ||
destroyTooltipOnHide: true, | ||
mouseEnterDelay: 0.1, | ||
mouseLeaveDelay: 0.2, | ||
overlay: 'overlay-test', | ||
overlayClassName: 'tooltip', | ||
showArrow: false, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import { default as ReactTooltip } from 'rc-tooltip'; | ||
import { TooltipProps } from 'rc-tooltip/lib/Tooltip'; | ||
import './styles.scss'; | ||
|
||
export interface Properties extends TooltipProps { | ||
className?: string; | ||
} | ||
|
||
export default class Tooltip extends React.Component<Properties> { | ||
render() { | ||
return ( | ||
<ReactTooltip | ||
overlayClassName={classNames('tooltip', this.props.className)} | ||
showArrow={false} | ||
mouseEnterDelay={0.1} | ||
mouseLeaveDelay={0.2} | ||
destroyTooltipOnHide={true} | ||
{...this.props} | ||
> | ||
{this.props.children} | ||
</ReactTooltip> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@use '../../shared-components/theme-engine/theme' as theme; | ||
@import 'rc-tooltip/assets/bootstrap.css'; | ||
@import '../../variables'; | ||
|
||
.tooltip { | ||
.rc-tooltip-inner { | ||
color: #ccc; | ||
border-radius: 4px; | ||
box-shadow: 2px 4px 5px 0 rgb(0 0 0 / 50%); | ||
background: theme.$background-color-primary; | ||
padding: 5px; | ||
min-height: unset; | ||
font-size: $font-size-medium; | ||
font-weight: 400; | ||
text-align: center; | ||
} | ||
|
||
&.rc-tooltip-placement-left { | ||
padding: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.