application-amicale/components/Home/SquareDashboardItem.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

import * as React from 'react';
import {Badge, IconButton, withTheme} from 'react-native-paper';
import {View} from "react-native";
2020-03-29 14:46:44 +02:00
/**
* Component used to render a small dashboard item
*
* @param props Props to pass to the component
* @return {*}
*/
function SquareDashboardItem(props) {
const {colors} = props.theme;
return (
<View>
<IconButton
icon={props.icon}
color={
2020-03-29 14:46:44 +02:00
props.isAvailable
? props.color
: colors.textDisabled
}
size={35}
onPress={props.clickAction}
/>
{
props.badgeNumber > 0 ?
<Badge
style={{
position: 'absolute',
top: 5,
right: 5
2020-03-29 14:46:44 +02:00
}}>
{props.badgeNumber}
</Badge> : null
}
</View>
);
}
export default withTheme(SquareDashboardItem);