-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tooltip from pivotal-ui * updates from bevacqua review * add title property * update demo with warning and show source + html * put title in tooltip-content div * do not allow tooltip to overflow window bounds * add space to demos * fix lint errors * check cross dimension for tooltip placement * rename cross dimension overflow function for better readability * ensure tooltip opened by click does not get clipped by window viewport * move overflow logic to service
- Loading branch information
Showing
14 changed files
with
708 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
TooltipTrigger, | ||
} from '../../../../src/components'; | ||
|
||
const autoPlacementTooltip = `I should be on the top but may get placed in another location | ||
if I overflow the browser window. This will come in handy when tooltips get placed near the top | ||
of pages. Its very hard to read a tooltip when part of it gets cut off and if you can't read it | ||
then what is the point?`; | ||
|
||
export default () => ( | ||
<div> | ||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip="I am the body" title="I am the title"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip with title.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip={autoPlacementTooltip} placement="top" size="m"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip on the top.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip={autoPlacementTooltip} placement="top" size="m" trigger="click"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip on click.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip="I should be on the left" placement="left"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip on the left.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
|
||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip="I should be on the right" placement="right"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip on the right.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
|
||
<div> | ||
Check out this {( | ||
<TooltipTrigger tooltip="I should be on the bottom" placement="bottom"> | ||
<span className="overlay-trigger" tabIndex="0"> tooltip on the bottom.</span> | ||
</TooltipTrigger> | ||
)} | ||
</div> | ||
</div> | ||
); |
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,49 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
|
||
import { | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
import { | ||
EuiCallOut, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
import TooltipExamples from './examples'; | ||
const examplesSource = require('!!raw-loader!./examples'); | ||
const examplesHtml = renderToHtml(TooltipExamples); | ||
|
||
export const TooltipExample = { | ||
title: 'Tooltip', | ||
intro: ( | ||
<div> | ||
<EuiCallOut | ||
title="Work in progress" | ||
color="warning" | ||
> | ||
<p> | ||
This component is still undergoing active development, and its interface and implementation | ||
are both subject to change. | ||
</p> | ||
</EuiCallOut> | ||
|
||
<EuiSpacer size="l" /> | ||
</div> | ||
), | ||
sections: [{ | ||
title: 'Tooltip', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: examplesSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: examplesHtml, | ||
}], | ||
text: ( | ||
<p /> | ||
), | ||
demo: <TooltipExamples />, | ||
}], | ||
}; |
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
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 @@ | ||
@import "tooltip"; |
Oops, something went wrong.