application-amicale/components/Home/SmallDashboardItem.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 {*}
*/
2020-04-04 13:52:16 +02:00
function SmallDashboardItem(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>
);
}
2020-04-04 13:52:16 +02:00
export default withTheme(SmallDashboardItem);