Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paragon
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
paragon
Commits
8d90814d
Commit
8d90814d
authored
Nov 06, 2017
by
Michael Roytman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
very rough tooltip
parent
6ad42ee2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
0 deletions
+70
-0
src/ToolTip/Tooltip.scss
+1
-0
src/ToolTip/Tooltip.stories.jsx
+9
-0
src/ToolTip/index.jsx
+60
-0
No files found.
src/ToolTip/Tooltip.scss
0 → 100644
View file @
8d90814d
@import
"~bootstrap/scss/_tooltip"
;
src/ToolTip/Tooltip.stories.jsx
0 → 100644
View file @
8d90814d
import
React
from
'react'
;
import
{
storiesOf
}
from
'@storybook/react'
;
import
Tooltip
from
'./index'
;
storiesOf
(
'Tooltip'
,
module
)
.
add
(
'basic usage'
,
()
=>
(
<
Tooltip
/>
));
src/ToolTip/index.jsx
0 → 100644
View file @
8d90814d
import
React
from
'react'
;
import
classNames
from
'classnames'
;
import
PropTypes
from
'prop-types'
;
import
Button
from
'../Button'
;
import
styles
from
'./Tooltip.scss'
;
export
default
class
Tooltip
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
handleMouseOver
=
this
.
handleMouseOver
.
bind
(
this
);
this
.
handleMouseOut
=
this
.
handleMouseOut
.
bind
(
this
);
this
.
state
=
{
mouseOver
:
false
,
};
}
handleMouseOver
()
{
this
.
setState
({
mouseOver
:
true
,
});
}
handleMouseOut
()
{
this
.
setState
({
mouseOver
:
false
,
});
}
render
()
{
// return (
// <div onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut} >
// <Button
// label={<span>Mouse over me for a tooltip!</span>}
// />
// {this.state.mouseOver && <span className={classNames(styles['tooltip-inner'], styles['tooltip-bottom'])}>Tooltip text</span>}
// </div>
// );
return
(
<
div
className=
{
classNames
(
styles
.
tooltip
,
styles
.
show
)
}
role=
"tooltip"
onMouseOver=
{
this
.
handleMouseOver
}
onMouseOut=
{
this
.
handleMouseOut
}
>
{
this
.
props
.
children
}
<
Button
label=
"Tooltip!"
/>
<
div
className=
{
classNames
(
styles
[
'arrow'
])
}
/>
{
this
.
state
.
mouseOver
&&
<
div
className=
{
classNames
(
styles
[
'tooltip-inner'
])
}
>
I am the tooltip!
</
div
>
}
</
div
>
);
}
}
Tooltip
.
propTypes
=
{
toolTipText
:
PropTypes
.
oneOfType
([
PropTypes
.
string
,
PropTypes
.
element
]).
isRequired
,
toolTipPosition
:
PropTypes
.
string
.
isRequired
,
children
:
PropTypes
.
element
.
isRequired
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment