Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
backup
Drip
Commits
f0caffac
Commit
f0caffac
authored
4 years ago
by
mashazyu
Committed by
Sofiya Tepikin
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Moves MenuItem component from Header to separate file, naming update
parent
bf4446c7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/header/index.js
+1
-1
1 addition, 1 deletion
components/header/index.js
components/header/menu-item.js
+47
-0
47 additions, 0 deletions
components/header/menu-item.js
components/header/side-menu.js
+14
-50
14 additions, 50 deletions
components/header/side-menu.js
with
62 additions
and
51 deletions
components/header/index.js
+
1
−
1
View file @
f0caffac
...
...
@@ -23,7 +23,7 @@ export default class Header extends Component {
return
(
<
View
style
=
{
styles
.
header
}
>
<
Logo
/>
<
SideMenu
shouldShowMenu
=
{
shouldShowMenu
}
onPress
=
{
this
.
toggleMenu
}
/
>
<
SideMenu
shouldShowMenu
=
{
shouldShowMenu
}
toggleMenu
=
{
this
.
toggleMenu
}
/
>
<
/View
>
)
}
...
...
This diff is collapsed.
Click to expand it.
components/header/menu-item.js
0 → 100644
+
47
−
0
View file @
f0caffac
import
React
from
'
react
'
import
{
StyleSheet
,
TouchableOpacity
}
from
'
react-native
'
import
PropTypes
from
'
prop-types
'
import
AppText
from
'
../common/app-text
'
import
{
connect
}
from
'
react-redux
'
import
{
navigate
}
from
'
../../slices/navigation
'
import
{
Typography
}
from
'
../../styles/redesign
'
const
MenuItem
=
({
item
,
navigate
,
closeMenu
})
=>
{
const
{
component
,
name
}
=
item
const
onPress
=
()
=>
{
closeMenu
()
navigate
(
component
)
}
return
(
<
TouchableOpacity
onPress
=
{
onPress
}
>
<
AppText
style
=
{
styles
.
text
}
>
{
name
}
<
/AppText
>
<
/TouchableOpacity
>
)
}
MenuItem
.
propTypes
=
{
item
:
PropTypes
.
object
.
isRequired
,
navigate
:
PropTypes
.
func
.
isRequired
,
closeMenu
:
PropTypes
.
func
.
isRequired
}
const
styles
=
StyleSheet
.
create
({
text
:
{
...
Typography
.
subtitle
}
})
const
mapDispatchToProps
=
(
dispatch
)
=>
{
return
({
navigate
:
(
page
)
=>
dispatch
(
navigate
(
page
)),
})
}
export
default
connect
(
null
,
mapDispatchToProps
,
)(
MenuItem
)
This diff is collapsed.
Click to expand it.
components/header/side-menu.js
+
14
−
50
View file @
f0caffac
...
...
@@ -3,52 +3,44 @@ import { Modal, StyleSheet, TouchableOpacity, View } from 'react-native'
import
PropTypes
from
'
prop-types
'
import
AppIcon
from
'
../common/app-icon
'
import
AppText
from
'
../common/app-text
'
import
MenuItem
from
'
./menu-item
'
import
{
connect
}
from
'
react-redux
'
import
{
navigate
}
from
'
../../slices/navigation
'
import
{
Sizes
,
Typography
}
from
'
../../styles/redesign
'
import
{
Sizes
}
from
'
../../styles/redesign
'
import
settingsLabels
from
'
../../i18n/en/settings
'
const
{
menuItems
}
=
settingsLabels
const
settingsMenuItems
=
[
{
name
:
menuItems
.
settings
,
component
:
'
SettingsMenu
'
},
{
name
:
menuItems
.
about
,
component
:
'
About
'
},
{
name
:
menuItems
.
license
,
component
:
'
License
'
},
{
name
:
menuItems
.
settings
,
component
:
'
SettingsMenu
'
},
{
name
:
menuItems
.
about
,
component
:
'
About
'
},
{
name
:
menuItems
.
license
,
component
:
'
License
'
},
]
const
SideMenu
=
({
navigate
,
onPress
,
shouldShowMenu
})
=>
{
const
navigateMenuItem
=
(
page
)
=>
{
onPress
()
navigate
(
page
)
}
const
SideMenu
=
({
shouldShowMenu
,
toggleMenu
})
=>
{
return
(
<
React
.
Fragment
>
{
!
shouldShowMenu
&&
<
TouchableOpacity
onPress
=
{
onPress
}
>
<
TouchableOpacity
onPress
=
{
toggleMenu
}
>
<
AppIcon
name
=
{
'
dots-three-vertical
'
}
isCTA
/>
<
/TouchableOpacity
>
}
{
shouldShowMenu
&&
<
Modal
animationType
=
'
fade
'
onRequestClose
=
{
onPress
}
onRequestClose
=
{
toggleMenu
}
transparent
=
{
true
}
visible
=
{
shouldShowMenu
}
>
<
View
style
=
{
styles
.
blackBackground
}
><
/View
>
<
View
style
=
{
styles
.
menu
}
>
<
TouchableOpacity
onPress
=
{
onPress
}
style
=
{
styles
.
iconContainer
}
>
<
AppIcon
name
=
{
'
cross
'
}
/
>
<
TouchableOpacity
onPress
=
{
toggleMenu
}
style
=
{
styles
.
iconContainer
}
>
<
AppIcon
name
=
{
'
cross
'
}
isCTA
=
{
false
}
/
>
<
/TouchableOpacity
>
{
settingsMenuItems
.
map
(
item
=>
<
MenuItem
item
=
{
item
}
key
=
{
item
.
name
}
navigate
=
{
navigat
eMenu
Item
}
closeMenu
=
{
toggl
eMenu
}
/
>
)}
<
/View
>
...
...
@@ -59,24 +51,8 @@ const SideMenu = ({ navigate, onPress, shouldShowMenu }) => {
}
SideMenu
.
propTypes
=
{
navigate
:
PropTypes
.
func
.
isRequired
,
onPress
:
PropTypes
.
func
,
shouldShowMenu
:
PropTypes
.
bool
.
isRequired
}
const
MenuItem
=
({
item
,
navigate
})
=>
{
return
(
<
View
style
=
{
styles
.
menuItem
}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
(
item
.
component
)}
>
<
AppText
style
=
{
styles
.
text
}
>
{
item
.
name
}
<
/AppText
>
<
/TouchableOpacity
>
<
/View
>
)
}
MenuItem
.
propTypes
=
{
item
:
PropTypes
.
object
.
isRequired
,
navigate
:
PropTypes
.
func
.
isRequired
,
shouldShowMenu
:
PropTypes
.
bool
.
isRequired
,
toggleMenu
:
PropTypes
.
func
}
const
styles
=
StyleSheet
.
create
({
...
...
@@ -96,19 +72,7 @@ const styles = StyleSheet.create({
padding
:
Sizes
.
base
,
position
:
'
absolute
'
,
width
:
'
60%
'
},
text
:
{
...
Typography
.
subtitle
}
})
const
mapDispatchToProps
=
(
dispatch
)
=>
{
return
({
navigate
:
(
page
)
=>
dispatch
(
navigate
(
page
)),
})
}
export
default
connect
(
null
,
mapDispatchToProps
,
)(
SideMenu
)
export
default
SideMenu
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