mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-21 12:21:31 +03:00
created profile edit ui
This commit is contained in:
parent
89528df717
commit
d1b52d2623
@ -27,7 +27,7 @@ class FormInputView extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
value: '',
|
value: props.value || '',
|
||||||
inputBorderColor: '#c1c5c7',
|
inputBorderColor: '#c1c5c7',
|
||||||
isValid: true,
|
isValid: true,
|
||||||
};
|
};
|
||||||
|
@ -10,5 +10,37 @@ export default EStyleSheet.create({
|
|||||||
formStyle: {
|
formStyle: {
|
||||||
backgroundColor: '$white',
|
backgroundColor: '$white',
|
||||||
height: 30,
|
height: 30,
|
||||||
|
marginTop: 8,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
fontSize: 14,
|
||||||
|
color: '$primaryDarkText',
|
||||||
|
fontWeight: '500',
|
||||||
|
},
|
||||||
|
formItem: {
|
||||||
|
marginBottom: 24,
|
||||||
|
},
|
||||||
|
coverImg: {
|
||||||
|
borderRadius: 5,
|
||||||
|
height: 60,
|
||||||
|
marginBottom: 12,
|
||||||
|
alignSelf: 'stretch',
|
||||||
|
backgroundColor: '#296CC0',
|
||||||
|
},
|
||||||
|
coverImageWrapper: {},
|
||||||
|
addIcon: {
|
||||||
|
color: '$white',
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
addButton: {
|
||||||
|
backgroundColor: '$iconColor',
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
borderRadius: 20 / 2,
|
||||||
|
borderColor: '$white',
|
||||||
|
borderWidth: 1,
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
right: 10,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,32 +1,132 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { withNavigation } from 'react-navigation';
|
import { withNavigation } from 'react-navigation';
|
||||||
import { View, Text, Platform } from 'react-native';
|
import { View, TouchableOpacity, Image, Text, Platform } from 'react-native';
|
||||||
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
||||||
|
|
||||||
|
// Images
|
||||||
|
import LIGHT_COVER_IMAGE from '../../assets/default_cover_image.png';
|
||||||
|
import DARK_COVER_IMAGE from '../../assets/dark_cover_image.png';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { FormInput } from '../formInput';
|
import { FormInput } from '../formInput';
|
||||||
|
import { IconButton } from '../iconButton';
|
||||||
// Styles
|
// Styles
|
||||||
import styles from './profileEditFormStyles';
|
import styles from './profileEditFormStyles';
|
||||||
|
|
||||||
const ProfileEditFormView = ({ avatarUrl, coverUrl, name, about, location, website }) => (
|
const ProfileEditFormView = ({
|
||||||
|
avatarUrl,
|
||||||
|
coverUrl,
|
||||||
|
name,
|
||||||
|
about,
|
||||||
|
location,
|
||||||
|
website,
|
||||||
|
isDarkTheme,
|
||||||
|
}) => (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<KeyboardAwareScrollView
|
<KeyboardAwareScrollView
|
||||||
enableAutoAutomaticScroll={Platform.OS === 'ios'}
|
enableAutoAutomaticScroll={Platform.OS === 'ios'}
|
||||||
contentContainerStyle={{ flexGrow: 1 }}
|
contentContainerStyle={{ flexGrow: 1 }}
|
||||||
>
|
>
|
||||||
<Text>Profile picture URL</Text>
|
<View style={styles.formItem}>
|
||||||
<FormInput
|
<Text style={styles.label}>Profile picture URL</Text>
|
||||||
wrapperStyle={styles.formStyle}
|
<FormInput
|
||||||
isValid
|
wrapperStyle={styles.formStyle}
|
||||||
height={30}
|
isValid
|
||||||
onChange={value => alert('changed')}
|
height={30}
|
||||||
placeholder="profile picture url"
|
onChange={value => alert('changed')}
|
||||||
isEditable
|
placeholder="profile picture url"
|
||||||
type="username"
|
isEditable
|
||||||
isFirstImage
|
type="text"
|
||||||
value="sex"
|
value={avatarUrl}
|
||||||
/>
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.formItem}>
|
||||||
|
<Text style={styles.label}>Cover image URL</Text>
|
||||||
|
<FormInput
|
||||||
|
wrapperStyle={styles.formStyle}
|
||||||
|
isValid
|
||||||
|
height={30}
|
||||||
|
onChange={value => alert('changed')}
|
||||||
|
placeholder="Cover image URL"
|
||||||
|
isEditable
|
||||||
|
type="text"
|
||||||
|
value={coverUrl}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<TouchableOpacity style={styles.coverImgWrapper} onPress={() => alert('upload')}>
|
||||||
|
<Image
|
||||||
|
style={styles.coverImg}
|
||||||
|
source={{ uri: `https://steemitimages.com/400x0/${coverUrl}` }}
|
||||||
|
defaultSource={isDarkTheme ? DARK_COVER_IMAGE : LIGHT_COVER_IMAGE}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
iconStyle={styles.addIcon}
|
||||||
|
style={styles.addButton}
|
||||||
|
iconType="MaterialCommunityIcons"
|
||||||
|
name="plus"
|
||||||
|
onPress={() => alert('upload')}
|
||||||
|
size={15}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<View style={styles.formItem}>
|
||||||
|
<Text style={styles.label}>Display Name</Text>
|
||||||
|
<FormInput
|
||||||
|
wrapperStyle={styles.formStyle}
|
||||||
|
isValid
|
||||||
|
height={30}
|
||||||
|
onChange={value => alert('changed')}
|
||||||
|
placeholder="Display name"
|
||||||
|
isEditable
|
||||||
|
type="text"
|
||||||
|
value={name}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.formItem}>
|
||||||
|
<Text style={styles.label}>About</Text>
|
||||||
|
<FormInput
|
||||||
|
wrapperStyle={styles.formStyle}
|
||||||
|
isValid
|
||||||
|
height={30}
|
||||||
|
onChange={value => alert('changed')}
|
||||||
|
placeholder="About"
|
||||||
|
isEditable
|
||||||
|
type="text"
|
||||||
|
value={about}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.formItem}>
|
||||||
|
<Text style={styles.label}>Location</Text>
|
||||||
|
<FormInput
|
||||||
|
wrapperStyle={styles.formStyle}
|
||||||
|
isValid
|
||||||
|
height={30}
|
||||||
|
onChange={value => alert('changed')}
|
||||||
|
placeholder="Location"
|
||||||
|
isEditable
|
||||||
|
type="text"
|
||||||
|
value={location}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.formItem}>
|
||||||
|
<Text style={styles.label}>Website</Text>
|
||||||
|
<FormInput
|
||||||
|
wrapperStyle={styles.formStyle}
|
||||||
|
isValid
|
||||||
|
height={30}
|
||||||
|
onChange={value => alert('changed')}
|
||||||
|
placeholder="Website"
|
||||||
|
isEditable
|
||||||
|
type="text"
|
||||||
|
value={website}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</KeyboardAwareScrollView>
|
</KeyboardAwareScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -21,12 +21,13 @@ class ProfileEditContainer extends Component {
|
|||||||
_handleOnSave = () => {};
|
_handleOnSave = () => {};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { children, currentAccount } = this.props;
|
const { children, currentAccount, isDarkTheme } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
children &&
|
children &&
|
||||||
children({
|
children({
|
||||||
currentAccount,
|
currentAccount,
|
||||||
|
isDarkTheme,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -34,6 +35,7 @@ class ProfileEditContainer extends Component {
|
|||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
currentAccount: state.account.currentAccount,
|
currentAccount: state.account.currentAccount,
|
||||||
|
isDarkTheme: state.application.isDarkTheme,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps)(ProfileEditContainer);
|
export default connect(mapStateToProps)(ProfileEditContainer);
|
||||||
|
@ -25,21 +25,22 @@ class ProfileEditScreen extends PureComponent {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<ProfileEditContainer>
|
<ProfileEditContainer>
|
||||||
{({ currentAccount }) => (
|
{({ currentAccount, isDarkTheme }) => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<AvatarHeader
|
<AvatarHeader
|
||||||
username={get(currentAccount, 'name')}
|
username={get(currentAccount, 'name')}
|
||||||
name={get(currentAccount, 'about.profile.name')}
|
name={get(currentAccount, 'about.profile.name')}
|
||||||
reputation={get(currentAccount, 'reputation')}
|
reputation={get(currentAccount, 'reputation')}
|
||||||
avatarUrl={null}
|
avatarUrl={get(currentAccount, 'avatar')}
|
||||||
/>
|
/>
|
||||||
<ProfileEditForm
|
<ProfileEditForm
|
||||||
|
isDarkTheme={isDarkTheme}
|
||||||
about={get(currentAccount, 'about.profile.about')}
|
about={get(currentAccount, 'about.profile.about')}
|
||||||
name={get(currentAccount, 'about.profile.name')}
|
name={get(currentAccount, 'about.profile.profile.name')}
|
||||||
location="location"
|
location={get(currentAccount, 'about.profile.profile.location')}
|
||||||
website="website"
|
website={get(currentAccount, 'about.profile.profile.website')}
|
||||||
coverUrl={get(currentAccount, 'reputation')}
|
coverUrl={get(currentAccount, 'about.profile.cover_image')}
|
||||||
avatarUrl={null}
|
avatarUrl={get(currentAccount, 'avatar')}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user