Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
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
Administrator
bkunyun
Commits
026af981
Commit
026af981
authored
Sep 21, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: tooltip组件修改
parent
e1902451
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
MyTooltip.tsx
src/components/mui/MyTooltip.tsx
+22
-2
No files found.
src/components/mui/MyTooltip.tsx
View file @
026af981
...
...
@@ -8,6 +8,7 @@
*/
import
{
Tooltip
,
TooltipProps
}
from
"@mui/material"
;
import
{
ThemeProvider
,
createTheme
}
from
"@mui/material/styles"
;
import
{
useMemo
}
from
"react"
;
interface
IMyTooltipProps
extends
Omit
<
TooltipProps
,
"title"
>
{
title
?:
string
|
boolean
;
...
...
@@ -19,8 +20,8 @@ const theme = createTheme({
styleOverrides
:
{
tooltip
:
{
backgroundColor
:
"rgba(7, 19, 38, .8)"
,
padding
:
'8px 16px'
,
color
:
"#fff"
,
padding
:
0
,
},
arrow
:
{
"&:before"
:
{
...
...
@@ -35,12 +36,31 @@ const theme = createTheme({
const
MyTooltip
=
(
props
:
IMyTooltipProps
)
=>
{
const
{
title
=
false
,
children
,
placement
=
"top"
,
...
other
}
=
props
;
const
randerTitle
=
useMemo
(()
=>
{
if
(
title
)
{
return
(
<
div
style=
{
{
maxHeight
:
"36vh"
,
overflow
:
"overlay"
,
padding
:
"8px 16px"
,
}
}
>
{
title
}
</
div
>
);
}
else
{
return
""
;
}
},
[
title
]);
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
Tooltip
// interactive={true}
arrow
title=
{
title
||
''
}
title=
{
randerTitle
}
placement=
{
placement
}
{
...
other
}
>
...
...
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