-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from GoodDollar/kris/page-padding
fixed padding on ViewCollective mobile page; fixes for Stewards list
- Loading branch information
Showing
16 changed files
with
338 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
packages/app/src/components/StewardsList/StewardListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Image, StyleSheet, Text, View } from 'react-native'; | ||
import { VerifiedIconUri } from '../../@constants/ColorTypeIcons'; | ||
import { Colors } from '../../utils/colors'; | ||
import { InterRegular, InterSemiBold } from '../../utils/webFonts'; | ||
import { Steward } from '../../models/models'; | ||
import { profilePictureArray } from '../../@constants/pfps'; | ||
|
||
interface StewardListItemProps { | ||
steward: Steward; | ||
showActions: boolean; | ||
} | ||
|
||
export const StewardListItem = (props: StewardListItemProps) => { | ||
const { showActions, steward } = props; | ||
|
||
const randomIndex = Math.floor(Math.random() * profilePictureArray.length); | ||
const profileImage = profilePictureArray[randomIndex]; | ||
|
||
return ( | ||
<View style={styles.row}> | ||
<Image source={{ uri: profileImage }} style={styles.rowImg} /> | ||
<Text style={styles.title}> | ||
{steward.username}{' '} | ||
{steward.isVerified && <Image source={{ uri: VerifiedIconUri }} style={styles.verifiedIcon} />} | ||
</Text> | ||
{showActions && <Text style={styles.totalActions}>{steward.actions ?? 0} actions</Text>} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
rowImg: { | ||
height: 48, | ||
width: 48, | ||
borderRadius: 24, | ||
marginRight: 16, | ||
}, | ||
verifiedIcon: { | ||
height: 16, | ||
width: 16, | ||
}, | ||
row: { | ||
width: '100%', | ||
backgroundColor: Colors.white, | ||
flex: 1, | ||
flexDirection: 'row', | ||
marginVertical: 8, | ||
alignItems: 'center', | ||
}, | ||
title: { | ||
fontSize: 16, | ||
...InterSemiBold, | ||
width: '100%', | ||
color: Colors.black, | ||
}, | ||
totalActions: { | ||
fontSize: 14, | ||
...InterRegular, | ||
textAlign: 'right', | ||
width: '100%', | ||
color: Colors.gray[100], | ||
}, | ||
}); |
103 changes: 103 additions & 0 deletions
103
packages/app/src/components/StewardsList/StewardsList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { Image, Text, View, StyleSheet } from 'react-native'; | ||
import { InterRegular, InterSemiBold } from '../../utils/webFonts'; | ||
import { StewardBlueIcon, StewardGreenIcon } from '../../@constants/ColorTypeIcons'; | ||
import { Colors } from '../../utils/colors'; | ||
import { useMediaQuery } from 'native-base'; | ||
import { StewardListItem } from './StewardListItem'; | ||
import { Steward } from '../../models/models'; | ||
|
||
const mockStewardData: Steward[] = [0, 1, 2, 3, 4, 5, 6].map(() => ({ | ||
username: 'username' + Math.floor(Math.random() * 10000), | ||
isVerified: true, | ||
actions: 730, | ||
})); | ||
|
||
interface StewardListProps { | ||
listType: 'viewCollective' | 'viewStewards'; | ||
stewards: Steward[]; | ||
hideTitle?: boolean; | ||
} | ||
|
||
function StewardList({ listType, stewards, hideTitle }: StewardListProps) { | ||
const [isDesktopResolution] = useMediaQuery({ | ||
minWidth: 612, | ||
}); | ||
|
||
const toShow = listType === 'viewStewards' ? mockStewardData : mockStewardData.slice(0, isDesktopResolution ? 6 : 5); | ||
|
||
return ( | ||
<View style={styles.stewardsHeader}> | ||
{!hideTitle && ( | ||
<View style={[styles.row, { marginBottom: 24 }]}> | ||
{listType === 'viewCollective' && <Image source={{ uri: StewardGreenIcon }} style={styles.titleIcon} />} | ||
<Text style={styles.title}>Stewards{listType === 'viewCollective' ? ` (0)` : ''}</Text> | ||
{listType === 'viewStewards' && <Image source={{ uri: StewardBlueIcon }} style={styles.titleIcon} />} | ||
</View> | ||
)} | ||
<View style={styles.list}> | ||
{toShow.map((steward) => ( | ||
<StewardListItem steward={steward} showActions={listType === 'viewStewards'} key={steward.username} /> | ||
))} | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
stewardsHeader: { flex: 1 }, | ||
titleIcon: { | ||
height: 32, | ||
width: 32, | ||
marginRight: 8, | ||
}, | ||
rowImg: { | ||
height: 48, | ||
width: 48, | ||
borderRadius: 24, | ||
marginRight: 16, | ||
}, | ||
verifiedIcon: { | ||
height: 16, | ||
width: 16, | ||
}, | ||
rowTransactionIcon: { | ||
height: 32, | ||
width: 32, | ||
}, | ||
groupIcon: { | ||
width: 9, | ||
height: 8, | ||
}, | ||
row: { | ||
width: '100%', | ||
backgroundColor: Colors.white, | ||
flex: 1, | ||
flexDirection: 'row', | ||
marginVertical: 8, | ||
alignItems: 'center', | ||
}, | ||
title: { | ||
fontSize: 16, | ||
...InterSemiBold, | ||
width: '100%', | ||
color: Colors.black, | ||
}, | ||
totalActions: { | ||
fontSize: 14, | ||
...InterRegular, | ||
textAlign: 'right', | ||
width: '100%', | ||
color: Colors.gray[100], | ||
}, | ||
headerRow: { | ||
...InterRegular, | ||
}, | ||
stewardRow: { | ||
...InterSemiBold, | ||
}, | ||
list: { | ||
maxHeight: 400, | ||
overflow: 'scroll', | ||
}, | ||
}); | ||
export default StewardList; |
Oops, something went wrong.