Skip to content

Instantly share code, notes, and snippets.

@jerolan
Created February 18, 2019 23:03
Show Gist options
  • Save jerolan/584b3f8ec80eb4f4b52501f1a4041a11 to your computer and use it in GitHub Desktop.
Save jerolan/584b3f8ec80eb4f4b52501f1a4041a11 to your computer and use it in GitHub Desktop.
javascriptmid/profile-cards/blob/master/src/components/Card.js
import React from 'react';
import { Image, View, StyleSheet } from 'react-sketchapp';
import { ThemeConsumer } from './ThemeProvider';
import CardLayout from './CardLayout';
import Text from './Text';
const styles = StyleSheet.create({
CardContent: {
flex: 1,
padding: 64,
alignItems: 'center'
},
Avatar: {
marginBottom: 64,
height: 256,
width: 256,
objectFit: 'contain'
},
TextCenter: {
textAlign: 'center'
}
});
function CardText(props) {
return (
<Text as={props.as} style={[styles.TextCenter, props.style]}>
{props.children}
</Text>
);
}
export default function Card(props) {
return (
<CardLayout date={props.date} time={props.time} place={props.place}>
<ThemeConsumer>
{theme => (
<View style={styles.CardContent}>
<Image
style={styles.Avatar}
source={require('../images/logo.png')}
/>
<CardText as="Title" style={{ color: theme.colors.Yellow }}>
{props.title}
</CardText>
<CardText as="Subtitles" style={{ color: theme.colors.Lighter }}>
{props.name}
</CardText>
</View>
)}
</ThemeConsumer>
</CardLayout>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment