Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
frontend
Commits
09c0290e
Commit
09c0290e
authored
Feb 14, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hint component
parent
7ba4e7e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
11 deletions
+41
-11
DetailsInfoItem.tsx
ui/shared/DetailsInfoItem.tsx
+3
-11
Hint.tsx
ui/shared/Hint.tsx
+38
-0
No files found.
ui/shared/DetailsInfoItem.tsx
View file @
09c0290e
import
{
GridItem
,
Icon
,
Flex
,
Tooltip
,
Bo
x
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
GridItem
,
Fle
x
,
Text
}
from
'
@chakra-ui/react
'
;
import
type
{
HTMLChakraProps
}
from
'
@chakra-ui/system
'
;
import
type
{
HTMLChakraProps
}
from
'
@chakra-ui/system
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
infoIcon
from
'
icons/info.svg
'
;
import
Hint
from
'
ui/shared/Hint
'
;
interface
Props
extends
Omit
<
HTMLChakraProps
<
'
div
'
>
,
'
title
'
>
{
interface
Props
extends
Omit
<
HTMLChakraProps
<
'
div
'
>
,
'
title
'
>
{
title
:
React
.
ReactNode
;
title
:
React
.
ReactNode
;
...
@@ -16,15 +16,7 @@ const DetailsInfoItem = ({ title, hint, note, children, id, ...styles }: Props)
...
@@ -16,15 +16,7 @@ const DetailsInfoItem = ({ title, hint, note, children, id, ...styles }: Props)
<>
<>
<
GridItem
py=
{
{
base
:
1
,
lg
:
2
}
}
id=
{
id
}
lineHeight=
{
5
}
{
...
styles
}
whiteSpace=
"nowrap"
_notFirst=
{
{
mt
:
{
base
:
3
,
lg
:
0
}
}
}
>
<
GridItem
py=
{
{
base
:
1
,
lg
:
2
}
}
id=
{
id
}
lineHeight=
{
5
}
{
...
styles
}
whiteSpace=
"nowrap"
_notFirst=
{
{
mt
:
{
base
:
3
,
lg
:
0
}
}
}
>
<
Flex
columnGap=
{
2
}
alignItems=
"flex-start"
>
<
Flex
columnGap=
{
2
}
alignItems=
"flex-start"
>
<
Tooltip
<
Hint
text=
{
hint
}
/>
label=
{
hint
}
placement=
"top"
maxW=
"320px"
>
<
Box
cursor=
"pointer"
display=
"inherit"
>
<
Icon
as=
{
infoIcon
}
boxSize=
{
5
}
/>
</
Box
>
</
Tooltip
>
<
Text
fontWeight=
{
{
base
:
700
,
lg
:
500
}
}
>
<
Text
fontWeight=
{
{
base
:
700
,
lg
:
500
}
}
>
{
title
}
{
title
}
{
note
&&
<
Text
fontWeight=
{
500
}
variant=
"secondary"
fontSize=
"xs"
className=
"note"
align=
"right"
>
{
note
}
</
Text
>
}
{
note
&&
<
Text
fontWeight=
{
500
}
variant=
"secondary"
fontSize=
"xs"
className=
"note"
align=
"right"
>
{
note
}
</
Text
>
}
...
...
ui/shared/Hint.tsx
0 → 100644
View file @
09c0290e
import
{
chakra
,
IconButton
,
Tooltip
,
useDisclosure
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
InfoIcon
from
'
icons/info.svg
'
;
interface
Props
{
text
:
string
;
className
?:
string
;
}
const
Hint
=
({
text
,
className
}:
Props
)
=>
{
const
{
isOpen
,
onOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
return
(
<
Tooltip
label=
{
text
}
placement=
"top"
maxW=
"320px"
isOpen=
{
isOpen
}
>
<
IconButton
colorScheme=
"none"
aria
-
label=
"hint"
icon=
{
<
InfoIcon
/>
}
boxSize=
{
5
}
variant=
"simple"
display=
"inline-block"
flexShrink=
{
0
}
className=
{
className
}
onMouseEnter=
{
onOpen
}
onMouseLeave=
{
onClose
}
onClick=
{
onToggle
}
/>
</
Tooltip
>
);
};
export
default
React
.
memo
(
chakra
(
Hint
));
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