acupedia-mobile-ui/src/features/content/renderers/shared/ContentCountBadge.tsx

40 lines
838 B
TypeScript

import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
export function ContentCountBadge({
count,
label,
}: {
count: number | null;
label?: string;
}) {
if (count === null) return null;
return (
<View style={styles.badge}>
<Text style={styles.text}>
{count}
{label ? ` ${label}` : ""}
</Text>
</View>
);
}
const styles = StyleSheet.create({
badge: {
backgroundColor: "#F3F4F6",
borderRadius: moderateScale(12),
paddingHorizontal: moderateScale(9),
paddingVertical: verticalScale(5),
marginRight: moderateScale(8),
},
text: {
fontSize: moderateScale(11),
fontWeight: "700",
color: Colors.textSecondary,
},
});