application-amicale/components/EventDashboardItem.js

59 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-03-09 19:00:12 +01:00
// @flow
import * as React from 'react';
import {Avatar, Card, withTheme} from 'react-native-paper';
2020-03-29 14:46:44 +02:00
import {StyleSheet} from "react-native";
2020-03-09 19:00:12 +01:00
2020-03-29 14:46:44 +02:00
/**
* Component used to display a dashboard item containing a preview event
*
* @param props Props to pass to the component
* @return {*}
*/
2020-03-09 19:00:12 +01:00
function EventDashBoardItem(props) {
const {colors} = props.theme;
const iconColor = props.isAvailable ?
colors.planningColor :
colors.textDisabled;
const textColor = props.isAvailable ?
colors.text :
colors.textDisabled;
return (
<Card
2020-03-29 14:46:44 +02:00
style={styles.card}
2020-03-09 19:00:12 +01:00
onPress={props.clickAction}>
<Card.Title
title={props.title}
titleStyle={{color: textColor}}
subtitle={props.subtitle}
subtitleStyle={{color: textColor}}
2020-03-10 11:33:22 +01:00
left={() =>
<Avatar.Icon
icon={props.icon}
color={iconColor}
size={60}
2020-03-29 14:46:44 +02:00
style={styles.avatar}/>}
2020-03-09 19:00:12 +01:00
/>
<Card.Content>
{props.children}
</Card.Content>
</Card>
);
}
2020-03-29 14:46:44 +02:00
const styles = StyleSheet.create({
card: {
width: 'auto',
marginLeft: 10,
marginRight: 10,
marginTop: 10,
overflow: 'hidden',
},
avatar: {
backgroundColor: 'transparent'
}
});
2020-03-09 19:00:12 +01:00
export default withTheme(EventDashBoardItem);