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
3b9e452e
Commit
3b9e452e
authored
Aug 11, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smooth collapsing of left bar
parent
ee17ad79
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
15 deletions
+28
-15
getDefaultTransitionProps.ts
theme/utils/getDefaultTransitionProps.ts
+2
-2
NavFooter.tsx
ui/navigation/NavFooter.tsx
+3
-3
NavLink.tsx
ui/navigation/NavLink.tsx
+4
-0
Navigation.tsx
ui/navigation/Navigation.tsx
+19
-10
No files found.
theme/utils/getDefaultTransitionProps.ts
View file @
3b9e452e
export
default
function
getDefaultTransitionProps
()
{
export
default
function
getDefaultTransitionProps
(
props
?:
{
transitionProperty
:
string
}
)
{
return
{
return
{
transitionProperty
:
'
background-color, color, border-color
'
,
transitionProperty
:
`background-color, color, border-color
${
props
?.
transitionProperty
?
'
,
'
+
props
.
transitionProperty
:
''
}
`
,
transitionDuration: 'normal',
transitionDuration: 'normal',
transitionTimingFunction: 'ease',
transitionTimingFunction: 'ease',
};
};
...
...
ui/navigation/NavFooter.tsx
View file @
3b9e452e
...
@@ -25,13 +25,13 @@ const NavFooter = ({ isCollapsed }: Props) => {
...
@@ -25,13 +25,13 @@ const NavFooter = ({ isCollapsed }: Props) => {
spacing=
{
8
}
spacing=
{
8
}
borderTop=
"1px solid"
borderTop=
"1px solid"
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
width=
{
isCollapsed
?
'
20px
'
:
'
180px
'
}
paddingTop=
{
8
}
paddingTop=
{
8
}
marginTop=
{
20
}
marginTop=
{
20
}
// w="100%"
alignItems=
"flex-start"
alignItems=
"baseline"
color=
"gray.500"
color=
"gray.500"
fontSize=
"xs"
fontSize=
"xs"
{
...
getDefaultTransitionProps
()
}
{
...
getDefaultTransitionProps
(
{
transitionProperty
:
'
width
'
}
)
}
>
>
<
Stack
direction=
{
isCollapsed
?
'
column
'
:
'
row
'
}
>
<
Stack
direction=
{
isCollapsed
?
'
column
'
:
'
row
'
}
>
{
SOCIAL_LINKS
.
map
(
sl
=>
{
{
SOCIAL_LINKS
.
map
(
sl
=>
{
...
...
ui/navigation/NavLink.tsx
View file @
3b9e452e
...
@@ -3,6 +3,8 @@ import NextLink from 'next/link';
...
@@ -3,6 +3,8 @@ import NextLink from 'next/link';
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
useColors
from
'
./useColors
'
;
import
useColors
from
'
./useColors
'
;
interface
Props
{
interface
Props
{
...
@@ -30,6 +32,8 @@ const NavLink = ({ text, pathname, icon, isCollapsed }: Props) => {
...
@@ -30,6 +32,8 @@ const NavLink = ({ text, pathname, icon, isCollapsed }: Props) => {
bgColor=
{
isActive
?
colors
.
bg
.
active
:
colors
.
bg
.
default
}
bgColor=
{
isActive
?
colors
.
bg
.
active
:
colors
.
bg
.
default
}
_hover=
{
{
color
:
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
}
_hover=
{
{
color
:
isActive
?
colors
.
text
.
active
:
colors
.
text
.
hover
}
}
borderRadius=
"base"
borderRadius=
"base"
whiteSpace=
"nowrap"
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
,
padding
'
})
}
>
>
<
HStack
spacing=
{
3
}
>
<
HStack
spacing=
{
3
}
>
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
<
Icon
as=
{
icon
}
boxSize=
"30px"
/>
...
...
ui/navigation/Navigation.tsx
View file @
3b9e452e
import
{
ChevronLeftIcon
}
from
'
@chakra-ui/icons
'
;
import
{
ChevronLeftIcon
}
from
'
@chakra-ui/icons
'
;
import
{
Flex
,
HStack
,
Icon
,
Box
,
VStack
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Icon
,
Box
,
VStack
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
abiIcon
from
'
icons/ABI.svg
'
;
import
abiIcon
from
'
icons/ABI.svg
'
;
...
@@ -54,17 +54,24 @@ const Navigation = () => {
...
@@ -54,17 +54,24 @@ const Navigation = () => {
px=
{
isCollapsed
?
4
:
6
}
px=
{
isCollapsed
?
4
:
6
}
py=
{
12
}
py=
{
12
}
width=
{
isCollapsed
?
'
92px
'
:
'
229px
'
}
width=
{
isCollapsed
?
'
92px
'
:
'
229px
'
}
{
...
getDefaultTransitionProps
()
}
{
...
getDefaultTransitionProps
(
{
transitionProperty
:
'
width
,
padding
'
}
)
}
>
>
<
HStack
<
Box
as=
"header"
as=
"header"
justifyContent=
{
isCollapsed
?
'
center
'
:
'
space-between
'
}
display=
"flex"
justifyContent=
"center"
alignItems=
"center"
alignItems=
"center"
flexDirection=
"row"
w=
"100%"
w=
"100%"
px=
{
3
}
px=
{
3
}
h=
{
10
}
h=
{
10
}
>
>
{
!
isCollapsed
&&
(
<
Box
width=
{
isCollapsed
?
'
0
'
:
'
113px
'
}
display=
"inline-flex"
overflow=
"hidden"
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
width
'
})
}
>
<
Icon
<
Icon
as=
{
logoIcon
}
as=
{
logoIcon
}
width=
"113px"
width=
"113px"
...
@@ -72,22 +79,23 @@ const Navigation = () => {
...
@@ -72,22 +79,23 @@ const Navigation = () => {
color=
{
logoColor
}
color=
{
logoColor
}
{
...
getDefaultTransitionProps
()
}
{
...
getDefaultTransitionProps
()
}
/>
/>
)
}
</
Box
>
<
Icon
<
Icon
as=
{
networksIcon
}
as=
{
networksIcon
}
width=
"16px"
width=
"16px"
height=
"16px"
height=
"16px"
color=
{
useColorModeValue
(
'
gray.500
'
,
'
white
'
)
}
color=
{
useColorModeValue
(
'
gray.500
'
,
'
white
'
)
}
{
...
getDefaultTransitionProps
()
}
marginLeft=
{
isCollapsed
?
'
0px
'
:
'
27px
'
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
margin
'
})
}
/>
/>
</
HStack
>
</
Box
>
<
Box
as=
"nav"
mt=
{
14
}
>
<
Box
as=
"nav"
mt=
{
14
}
>
<
VStack
as=
"ul"
spacing=
"2"
>
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
{
mainNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
/>)
}
{
mainNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
<
Box
as=
"nav"
mt=
{
12
}
>
<
Box
as=
"nav"
mt=
{
12
}
>
<
VStack
as=
"ul"
spacing=
"2"
>
<
VStack
as=
"ul"
spacing=
"2"
alignItems=
"flex-start"
overflow=
"hidden"
>
{
accountNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
/>)
}
{
accountNavItems
.
map
((
item
)
=>
<
NavLink
key=
{
item
.
text
}
{
...
item
}
isCollapsed=
{
isCollapsed
}
/>)
}
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
...
@@ -101,6 +109,7 @@ const Navigation = () => {
...
@@ -101,6 +109,7 @@ const Navigation = () => {
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderColor=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
borderRadius=
"base"
borderRadius=
"base"
transform=
{
isCollapsed
?
'
rotate(180deg)
'
:
'
rotate(0)
'
}
transform=
{
isCollapsed
?
'
rotate(180deg)
'
:
'
rotate(0)
'
}
{
...
getDefaultTransitionProps
({
transitionProperty
:
'
transform
'
})
}
transformOrigin=
"center"
transformOrigin=
"center"
position=
"absolute"
position=
"absolute"
top=
"104px"
top=
"104px"
...
...
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