Skip to content

Instantly share code, notes, and snippets.

@jerolan
Created February 18, 2019 23:02
Show Gist options
  • Select an option

  • Save jerolan/30f0b9f2cd827273fb17a9f49629391e to your computer and use it in GitHub Desktop.

Select an option

Save jerolan/30f0b9f2cd827273fb17a9f49629391e to your computer and use it in GitHub Desktop.
javascriptmid/profile-cards/blob/master/src/components/CardLayout.js
import React from 'react';
import { Image, View, StyleSheet } from 'react-sketchapp';
import { ThemeConsumer } from './ThemeProvider';
import Text from './Text';
const styles = StyleSheet.create({
Card: {
padding: 64,
height: 800,
width: 800
},
MiniLogo: {
height: 48,
width: 48
},
InfoRow: {
height: 48,
flexDirection: 'row',
justifyContent: 'space-between'
}
});
function CardText(props) {
return (
<ThemeConsumer>
{theme => (
<Text as="Text" style={{ color: theme.colors.Light }}>
{props.children}
</Text>
)}
</ThemeConsumer>
);
}
export default function CardLayout(props) {
return (
<ThemeConsumer>
{theme => (
<View style={[styles.Card, { backgroundColor: theme.colors.Darker }]}>
<View>
<Image
style={styles.MiniLogo}
source={require('../images/logo.png')}
/>
</View>
<View style={{ flex: 1 }}>{props.children}</View>
<View style={styles.InfoRow}>
<CardText>{props.date}</CardText>
<CardText>{`${props.time} Hrs`}</CardText>
<CardText>{props.place}</CardText>
</View>
</View>
)}
</ThemeConsumer>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment