Merge branch 'dev' of https://github.com/karlmacklin/react-toolbox into karlmacklin-dev
* 'dev' of https://github.com/karlmacklin/react-toolbox: Revert "Added required normalize.css package to package.json" Allow Link to render Tooltips via children prop Added required normalize.css package to package.jsonold
commit
c5666f0ebb
|
@ -3,7 +3,7 @@ import ClassNames from 'classnames';
|
|||
import style from './style';
|
||||
import FontIcon from '../font_icon';
|
||||
|
||||
const Link = (props) => {
|
||||
const Link = ({children, ...props}) => {
|
||||
const className = ClassNames(style.root, {
|
||||
[style.active]: props.active
|
||||
}, props.className);
|
||||
|
@ -13,12 +13,14 @@ const Link = (props) => {
|
|||
{props.icon ? <FontIcon className={style.icon} value={props.icon} /> : null}
|
||||
{props.label ? <abbr>{props.label}</abbr> : null}
|
||||
{props.count && parseInt(props.count) !== 0 ? <small>{props.count}</small> : null}
|
||||
{children ? children : null}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
|
||||
Link.propTypes = {
|
||||
active: React.PropTypes.bool,
|
||||
children: React.PropTypes.node,
|
||||
className: React.PropTypes.string,
|
||||
count: React.PropTypes.number,
|
||||
icon: React.PropTypes.string,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
line-height: 1.5;
|
||||
cursor: pointer;
|
||||
transition: opacity $animation-duration $animation-curve-default;
|
||||
|
|
|
@ -6,14 +6,17 @@ A Tooltip is useful to show information on hover in any kind of component. We ha
|
|||
```jsx
|
||||
import Button from 'react-toolbox/lib/button';
|
||||
import Tooltip from 'react-toolbox/lib/tooltip';
|
||||
import Link from 'react-toolbox/lib/link';
|
||||
|
||||
const TooltipButton = Tooltip(Button);
|
||||
const TooltipInput = Tooltip(Input);
|
||||
const TooltipLink = Tooltip(Link);
|
||||
|
||||
const TooltipTest = () => (
|
||||
<div>
|
||||
<TooltipButton label='Bookmark' icon='bookmark' raised primary tooltip='Bookmark Tooltip' tooltipDelay={1000} />
|
||||
<TooltipButton icon='add' floating accent tooltip='Floating Tooltip' />
|
||||
<TooltipLink count={42} href="#" label="The answer is" icon='speaker_notes' tooltip='Question - universe?'/>
|
||||
<TooltipInput tooltip='lorem ipsum...' />
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
const TooltipButton = Tooltip(Button);
|
||||
const TooltipInput = Tooltip(Input);
|
||||
const TooltipLink = Tooltip(Link);
|
||||
|
||||
const TooltipTest = () => (
|
||||
<div>
|
||||
<TooltipButton label='Bookmark' icon='bookmark' raised primary tooltip='Bookmark Tooltip' tooltipDelay={1000} />
|
||||
<TooltipButton icon='add' floating accent tooltip='Floating Tooltip' />
|
||||
<TooltipLink count={42} href="#" label="The answer is" icon='speaker_notes' tooltip='Question - universe?'/>
|
||||
<TooltipInput tooltip='lorem ipsum...' />
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue