Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gatsby Theme Onegeo
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OneGeo Suite
Libs
Gatsby Theme Onegeo
Commits
497b0cf7
Commit
497b0cf7
authored
1 year ago
by
Julien MARGAIL
Browse files
Options
Downloads
Patches
Plain Diff
simplify tooltip (include icon) - default text-info (adjust with theme)
parent
fd6cbf55
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Text.tsx
+4
-22
4 additions, 22 deletions
src/components/Text.tsx
src/components/core/Tooltip.tsx
+8
-7
8 additions, 7 deletions
src/components/core/Tooltip.tsx
with
12 additions
and
29 deletions
src/components/Text.tsx
+
4
−
22
View file @
497b0cf7
...
...
@@ -32,13 +32,7 @@ const Text = (props: IText) => {
)
}
>
{
title
}
{
oTooltip
.
title
?
(
<
Tooltip
text
=
{
oTooltip
.
title
}
>
<
InformationCircleIcon
className
=
"text-secondary h-5 w-5 cursor-pointer"
/>
</
Tooltip
>
)
:
(
<></>
)
}
<
Tooltip
text
=
{
oTooltip
.
title
}
/>
</
h2
>
)
}
{
subtitle
&&
(
...
...
@@ -48,14 +42,8 @@ const Text = (props: IText) => {
oClass
.
subtitle
)
}
>
{
subtitle
}{
"
"
}
{
oTooltip
.
subtitle
?
(
<
Tooltip
text
=
{
oTooltip
.
subtitle
}
>
<
InformationCircleIcon
className
=
"text-secondary h-5 w-5 cursor-pointer"
/>
</
Tooltip
>
)
:
(
<></>
)
}
{
subtitle
}
<
Tooltip
text
=
{
oTooltip
.
subtitle
}
/>
</
h4
>
)
}
{
content
&&
(
...
...
@@ -68,13 +56,7 @@ const Text = (props: IText) => {
)
}
dangerouslySetInnerHTML
=
{
{
__html
:
content
}
}
/>
{
oTooltip
.
content
?
(
<
Tooltip
text
=
{
oTooltip
.
content
}
>
<
InformationCircleIcon
className
=
"text-secondary h-5 w-5 cursor-pointer"
/>
</
Tooltip
>
)
:
(
<></>
)
}
<
Tooltip
text
=
{
oTooltip
.
content
}
/>
</>
)
}
{
action
&&
action
.
name
!==
""
?
(
...
...
This diff is collapsed.
Click to expand it.
src/components/core/Tooltip.tsx
+
8
−
7
View file @
497b0cf7
import
React
from
"
react
"
import
{
twMerge
}
from
"
tailwind-merge
"
import
{
InformationCircleIcon
}
from
"
@heroicons/react/outline
"
interface
Props
{
...
...
@@ -9,16 +11,15 @@ interface Props {
const
Tooltip
=
(
props
:
Props
)
=>
{
const
{
children
,
text
=
""
,
className
=
""
}
=
props
if
(
text
===
""
)
return
null
console
.
log
(
"
text
"
,
text
)
return
(
<
span
className
=
{
`
tooltip
${
className
}
`
}
>
<
div
className
=
"group inline-block"
>
{
children
}
<
div
className
=
"invisible absolute bottom-full left-1/2 z-10 mt-2
w-56 -translate-x-1/2 transform rounded-lg bg-white p-5 py-2 text-xs opacity-0 transition-all duration-300 group-hover:visible group-hover:opacity-100"
>
<
InformationCircleIcon
className
=
"text-
secondary
m-2 mx-auto h-
5
w-
5
text-center"
/>
<
span
className
=
{
twMerge
(
"
tooltip
"
,
className
)
}
>
<
div
className
=
"group
ml-2
inline-block"
>
<
InformationCircleIcon
className
=
"text-info h-4 w-4 cursor-pointer"
/>
<
div
className
=
"invisible absolute bottom-full left-1/2 z-10 mt-2 w-56 -translate-x-1/2 transform rounded-lg bg-white p-5 py-2 text-xs
font-normal
opacity-0
shadow
transition-all duration-300 group-hover:visible group-hover:opacity-100"
>
<
InformationCircleIcon
className
=
"text-
info
m-2 mx-auto h-
6
w-
6
text-center"
/>
{
text
}
{
/* <div className=" absolute left-1/2 h-4 w-4 -translate-x-2 rotate-45 transform border-gray-800 bg-white"></div> */
}
</
div
>
</
div
>
</
span
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment