Skip to content

Commit

Permalink
AccountDetails: Redesign to fit screens better.
Browse files Browse the repository at this point in the history
Long time ago we made a design decision to show the user's avatar
as wide as the screen (so quite large). While this makes it
attractive to look at, the size is often a bit too large.

Phones with small screens or phones with wide screens (which makes
the height of the avatar a bigger percentage of the total screen
height) leave too little space for other UI elements.

Now that we are showing a bit more, and especially in the upcoming
`ProfileCard`, it makes sense to 'tame' this UI a bit.

This makes the avatar a fixed size of 200x200 leaving enough space
below it even on smaller screens (tested on iPhone 5s).
  • Loading branch information
borisyankov authored and gnprice committed Feb 28, 2019
1 parent d1a3976 commit 57f45f4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/account-info/AccountDetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow strict-local */
import React, { PureComponent } from 'react';
import { View, Dimensions, StyleSheet } from 'react-native';
import { View, StyleSheet } from 'react-native';
import { connect } from 'react-redux';

import type { GlobalState, User } from '../types';
Expand All @@ -22,6 +22,8 @@ const componentStyles = StyleSheet.create({
},
});

const AVATAR_SIZE = 200;

type Props = {|
realm: string,
user: User,
Expand All @@ -30,16 +32,17 @@ type Props = {|
class AccountDetails extends PureComponent<Props, void> {
render() {
const { realm, user } = this.props;
const screenWidth = Dimensions.get('window').width;

return (
<View>
<UserAvatar
avatarUrl={getAvatarFromUser(user, realm, screenWidth)}
size={screenWidth}
shape="square"
/>
<ComponentList outerSpacing itemStyle={componentStyles.componentListItem}>
<View>
<UserAvatar
avatarUrl={getAvatarFromUser(user, realm, AVATAR_SIZE)}
size={AVATAR_SIZE}
shape="circle"
/>
</View>
<View style={componentStyles.statusWrapper}>
<PresenceStatusIndicator email={user.email} hideIfOffline={false} />
<RawLabel style={[styles.largerText, styles.halfMarginLeft]} text={user.email} />
Expand Down

0 comments on commit 57f45f4

Please sign in to comment.