Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooltip component #174

Merged
merged 12 commits into from
Dec 6, 2017
5 changes: 5 additions & 0 deletions src-docs/src/services/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ import { TitleExample }
import { ToastExample }
from '../../views/toast/toast_example';

import { TooltipExample }
from '../../views/tooltip/tooltip_example';


// Sandboxes

import AdvancedSettingsSandbox
Expand Down Expand Up @@ -193,6 +197,7 @@ const components = [
TextExample,
TitleExample,
ToastExample,
TooltipExample,
].map(example => createExample(example));

const sandboxes = [{
Expand Down
59 changes: 59 additions & 0 deletions src-docs/src/views/tooltip/examples.js
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>
);
49 changes: 49 additions & 0 deletions src-docs/src/views/tooltip/tooltip_example.js
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 />,
}],
};
5 changes: 5 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ export {
EuiToast,
} from './toast';

export {
Tooltip,
TooltipTrigger
} from './tooltip';

export {
EuiTitle,
} from './title';
Expand Down
1 change: 1 addition & 0 deletions src/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
@import 'tabs/index';
@import 'title/index';
@import 'toast/index';
@import 'tooltip/index';
@import 'text/index';
1 change: 1 addition & 0 deletions src/components/tooltip/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tooltip";
Loading