-
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.
* Add EuiIconTip.
- Loading branch information
Showing
8 changed files
with
170 additions
and
1 deletion.
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,37 @@ | ||
import React, { Fragment } from 'react'; | ||
|
||
import { | ||
EuiCheckbox, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiIconTip, | ||
EuiSpacer, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<Fragment> | ||
<EuiFlexGroup alignItems="center" gutterSize="s"> | ||
<EuiFlexItem grow={false}> | ||
<EuiCheckbox | ||
id="explainedCheckbox" | ||
label="Use source maps" | ||
onChange={() => {}} | ||
/> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem grow={false}> | ||
<EuiIconTip | ||
content="Source maps allow browser dev tools to map minified code to the original source code" | ||
position="right" | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
|
||
<EuiSpacer /> | ||
|
||
<EuiIconTip | ||
type="alert" | ||
content="I do not think it means what you think it means" | ||
/> | ||
</Fragment> | ||
); |
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 |
---|---|---|
|
@@ -260,6 +260,7 @@ export { | |
} from './toast'; | ||
|
||
export { | ||
EuiIconTip, | ||
EuiToolTip, | ||
} from './tool_tip'; | ||
|
||
|
45 changes: 45 additions & 0 deletions
45
src/components/tool_tip/__snapshots__/icon_tip.test.js.snap
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,45 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiIconTip is rendered 1`] = ` | ||
<span> | ||
<svg | ||
aria-describedby="id" | ||
class="euiIcon euiIcon--medium" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" | ||
/> | ||
<path | ||
d="M7.086 10.169c.01-.534.077-.955.2-1.264.123-.31.375-.653.755-1.03l.969-.907c.414-.426.621-.883.621-1.372 0-.47-.135-.84-.407-1.106-.27-.267-.665-.4-1.183-.4-.503 0-.908.12-1.214.363-.305.242-.458.567-.458.975H5c.01-.727.295-1.313.855-1.759C6.415 3.223 7.143 3 8.04 3c.932 0 1.658.228 2.178.683.52.455.781 1.079.781 1.872 0 .785-.4 1.558-1.199 2.32l-.806.727c-.36.363-.54.885-.54 1.567H7.086zM7.027 12.3c0-.202.068-.371.204-.508.135-.137.336-.205.603-.205.266 0 .468.068.606.205a.686.686 0 0 1 .207.508.664.664 0 0 1-.207.5c-.138.133-.34.199-.606.199-.267 0-.468-.066-.603-.198a.67.67 0 0 1-.204-.501z" | ||
/> | ||
</svg> | ||
</span> | ||
`; | ||
|
||
exports[`EuiIconTip props type is rendered as the icon 1`] = ` | ||
<span> | ||
<svg | ||
aria-describedby="id" | ||
class="euiIcon euiIcon--medium" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<g | ||
fill-rule="evenodd" | ||
> | ||
<path | ||
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z" | ||
/> | ||
<path | ||
d="M7 6h1v5H7zM7 12h1v1H7z" | ||
/> | ||
</g> | ||
</svg> | ||
</span> | ||
`; |
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,22 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { EuiIcon } from '../icon'; | ||
import { EuiToolTip } from './tool_tip'; | ||
|
||
export const EuiIconTip = ({ type, ...rest }) => ( | ||
<EuiToolTip {...rest}> | ||
<EuiIcon type={type} /> | ||
</EuiToolTip> | ||
); | ||
|
||
EuiIconTip.propTypes = { | ||
/** | ||
* The icon type. | ||
*/ | ||
type: PropTypes.string, | ||
}; | ||
|
||
EuiIconTip.defaultProps = { | ||
type: 'questionInCircle', | ||
}; |
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,29 @@ | ||
import React from 'react'; | ||
import { render } from 'enzyme'; | ||
import { requiredProps } from '../../test'; | ||
|
||
import { EuiIconTip } from './icon_tip'; | ||
|
||
describe('EuiIconTip', () => { | ||
test('is rendered', () => { | ||
const component = render( | ||
<EuiIconTip title="title" id="id" content="content" {...requiredProps} /> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
|
||
describe('props', () => { | ||
describe('type', () => { | ||
test('is rendered as the icon', () => { | ||
const component = render( | ||
<EuiIconTip type="alert" id="id" content="content" /> | ||
); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
}); |
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,7 @@ | ||
export { | ||
EuiToolTip, | ||
} from './tool_tip'; | ||
|
||
export { | ||
EuiIconTip, | ||
} from './icon_tip'; |