Moves Logo component to separate file
This commit is contained in:
@@ -1,21 +1,12 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
import { StyleSheet, View } from 'react-native'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import AppText from '../common/app-text'
|
import Logo from './logo'
|
||||||
import SideMenu from './side-menu'
|
import SideMenu from './side-menu'
|
||||||
|
|
||||||
import { connect } from 'react-redux'
|
import { Colors, Containers, Sizes } from '../../styles/redesign'
|
||||||
import { navigate } from '../../slices/navigation'
|
|
||||||
|
|
||||||
import { Colors, Containers, Fonts, Sizes } from '../../styles/redesign'
|
|
||||||
|
|
||||||
class Header extends Component {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
navigate: PropTypes.func.isRequired
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class Header extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
@@ -31,48 +22,17 @@ class Header extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<DripIcon navigate={this.props.navigate}/>
|
<Logo />
|
||||||
<SideMenu
|
<SideMenu shouldShowMenu={shouldShowMenu} onPress={this.toggleMenu}/>
|
||||||
shouldShowMenu={shouldShowMenu}
|
|
||||||
onPress={this.toggleMenu}
|
|
||||||
/>
|
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DripIcon = ({ navigate }) => {
|
|
||||||
return(
|
|
||||||
<TouchableOpacity onPress={() => navigate('Home')}>
|
|
||||||
<AppText style={styles.icon}>drip.</AppText>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
DripIcon.propTypes = {
|
|
||||||
navigate: PropTypes.func.isRequired
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
header: {
|
header: {
|
||||||
backgroundColor: Colors.purple,
|
backgroundColor: Colors.purple,
|
||||||
padding: Sizes.base,
|
padding: Sizes.base,
|
||||||
...Containers.rowContainer
|
...Containers.rowContainer
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
color: Colors.tourquiseDark,
|
|
||||||
fontFamily: Fonts.bold,
|
|
||||||
fontSize: Sizes.title
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
|
||||||
return({
|
|
||||||
navigate: (page) => dispatch(navigate(page)),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(
|
|
||||||
null,
|
|
||||||
mapDispatchToProps,
|
|
||||||
)(Header)
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
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 { Colors, Fonts, Sizes } from '../../styles/redesign'
|
||||||
|
|
||||||
|
const Logo = ({ navigate }) => {
|
||||||
|
return(
|
||||||
|
<TouchableOpacity onPress={() => navigate('Home')}>
|
||||||
|
<AppText style={styles.logo}>drip.</AppText>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Logo.propTypes = {
|
||||||
|
navigate: PropTypes.func.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
logo: {
|
||||||
|
color: Colors.tourquiseDark,
|
||||||
|
fontFamily: Fonts.bold,
|
||||||
|
fontSize: Sizes.title
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => {
|
||||||
|
return({
|
||||||
|
navigate: (page) => dispatch(navigate(page)),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
null,
|
||||||
|
mapDispatchToProps,
|
||||||
|
)(Logo)
|
||||||
Reference in New Issue
Block a user