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
160fb865
Commit
160fb865
authored
Aug 11, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tooltip when nav bar is collapsed
parent
d1d24dac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
18 deletions
+50
-18
Tooltip.ts
theme/components/Tooltip.ts
+22
-0
NavLink.tsx
ui/navigation/NavLink.tsx
+28
-18
No files found.
theme/components/Tooltip.ts
View file @
160fb865
import
{
Tooltip
as
TooltipComponent
}
from
'
@chakra-ui/react
'
;
import
{
Tooltip
as
TooltipComponent
}
from
'
@chakra-ui/react
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
ComponentStyleConfig
}
from
'
@chakra-ui/theme
'
;
import
type
{
SystemStyleFunction
}
from
'
@chakra-ui/theme-tools
'
;
import
{
mode
}
from
'
@chakra-ui/theme-tools
'
;
const
variantNav
:
SystemStyleFunction
=
(
props
)
=>
{
return
{
bg
:
mode
(
'
blue.50
'
,
'
gray.800
'
)(
props
),
color
:
'
blue.400
'
,
padding
:
'
15px 12px
'
,
minWidth
:
'
120px
'
,
borderRadius
:
'
base
'
,
fontSize
:
'
14px
'
,
lineHeight
:
'
20px
'
,
textAlign
:
'
center
'
,
boxShadow
:
'
none
'
,
fontWeight
:
'
500
'
,
};
};
const
variants
=
{
nav
:
variantNav
,
};
const
Tooltip
:
ComponentStyleConfig
=
{
const
Tooltip
:
ComponentStyleConfig
=
{
variants
,
baseStyle
:
{
baseStyle
:
{
maxWidth
:
'
unset
'
,
maxWidth
:
'
unset
'
,
},
},
...
...
ui/navigation/NavLink.tsx
View file @
160fb865
import
{
Link
,
Icon
,
Text
,
HStack
}
from
'
@chakra-ui/react
'
;
import
{
Link
,
Icon
,
Text
,
HStack
,
Tooltip
}
from
'
@chakra-ui/react
'
;
import
NextLink
from
'
next/link
'
;
import
NextLink
from
'
next/link
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -22,24 +22,34 @@ const NavLink = ({ text, pathname, icon, isCollapsed }: Props) => {
...
@@ -22,24 +22,34 @@ const NavLink = ({ text, pathname, icon, isCollapsed }: Props) => {
return
(
return
(
<
NextLink
href=
{
pathname
}
passHref
>
<
NextLink
href=
{
pathname
}
passHref
>
<
Link
<
Tooltip
as=
"li"
label=
{
text
}
listStyleType=
"none"
hasArrow=
{
false
}
w=
{
isCollapsed
?
'
60px
'
:
'
180px
'
}
isDisabled=
{
!
isCollapsed
}
px=
{
isCollapsed
?
'
15px
'
:
3
}
placement=
"right"
py=
{
2.5
}
variant=
"nav"
color=
{
isActive
?
colors
.
text
.
active
:
colors
.
text
.
default
}
gutter=
{
0
}
bgColor=
{
isActive
?
colors
.
bg
.
active
:
colors
.
bg
.
default
}
color=
{
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
_hover=
{
{
color
:
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
}
borderRadius=
"base"
whiteSpace=
"nowrap"
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
,
padding
'
})
}
>
>
<
HStack
spacing=
{
3
}
>
<
Link
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
as=
"li"
{
!
isCollapsed
&&
<
Text
variant=
"inherit"
>
{
text
}
</
Text
>
}
listStyleType=
"none"
</
HStack
>
w=
{
isCollapsed
?
'
60px
'
:
'
180px
'
}
</
Link
>
px=
{
isCollapsed
?
'
15px
'
:
3
}
py=
{
2.5
}
color=
{
isActive
?
colors
.
text
.
active
:
colors
.
text
.
default
}
bgColor=
{
isActive
?
colors
.
bg
.
active
:
colors
.
bg
.
default
}
_hover=
{
{
color
:
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
}
borderRadius=
"base"
whiteSpace=
"nowrap"
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
,
padding
'
})
}
>
<
HStack
spacing=
{
3
}
>
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
{
!
isCollapsed
&&
<
Text
variant=
"inherit"
>
{
text
}
</
Text
>
}
</
HStack
>
</
Link
>
</
Tooltip
>
</
NextLink
>
</
NextLink
>
);
);
};
};
...
...
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