-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1409 from cozy/feat/tooltip
feat: Import the tooltip component from MUI
- Loading branch information
Showing
3 changed files
with
33 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,8 @@ | ||
### Simplest usage | ||
|
||
```js | ||
import Tooltip from 'cozy-ui/transpiled/react/Tooltip'; | ||
<Tooltip title={'This is an explaination'}><u>hover over me</u></Tooltip> | ||
``` | ||
|
||
This component is imported from MUI and has the same API. |
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,24 @@ | ||
import { withStyles } from '@material-ui/core/styles' | ||
import { Tooltip } from '@material-ui/core' | ||
|
||
// We use css-in-js because using external css may create | ||
// conflicts of priorities between MUI and cozy-UI. | ||
// MUI always loads its styes at the end of <head>, making them | ||
// override any previous selector with the same specificity. | ||
// It also allows the code using this component to overrides | ||
// only some rules and not the whole classname. | ||
const styles = { | ||
tooltip: { | ||
backgroundColor: 'var(--paleGrey)', | ||
borderRadius: '8px', | ||
fontSize: '1rem', | ||
color: 'var(--black)', | ||
lineHeight: '1.3', | ||
boxShadow: | ||
'0 1px 3px 0 rgba(50, 54, 63, 0.19), 0 6px 18px 0 rgba(50, 54, 63, 0.19)' | ||
} | ||
} | ||
|
||
const StyledTooltip = withStyles(styles, { name: 'MuiTooltip' })(Tooltip) | ||
|
||
export default StyledTooltip |