90 lines
2.3 KiB
TypeScript
90 lines
2.3 KiB
TypeScript
import React from "react";
|
|
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
import { Ionicons } from "@expo/vector-icons";
|
|
import { moderateScale } from "react-native-size-matters";
|
|
|
|
import { Colors } from "@/theme";
|
|
import { asNumber, asString } from "../helpers/value";
|
|
import { CollectionScaffold } from "../shared/CollectionScaffold";
|
|
import type {
|
|
CollectionItemRendererProps,
|
|
CollectionRendererProps,
|
|
} from "../../types/renderer.types";
|
|
|
|
export function ThreeBurnersCollectionRenderer(props: CollectionRendererProps) {
|
|
return <CollectionScaffold {...props} />;
|
|
}
|
|
|
|
export function ThreeBurnersCardRenderer({
|
|
item,
|
|
onPress,
|
|
}: CollectionItemRendererProps) {
|
|
const a = item.attributes;
|
|
const title = asString(a.name) || asString(a.title) || item.title;
|
|
const sortOrder = asNumber(a.sort_order);
|
|
|
|
return (
|
|
<Pressable
|
|
accessibilityRole="button"
|
|
accessibilityLabel={title}
|
|
onPress={onPress}
|
|
style={({ pressed }) => [styles.cardRow, pressed && styles.pressed]}
|
|
>
|
|
<View style={styles.numberBadge}>
|
|
{typeof sortOrder === "number" ? (
|
|
<Text style={styles.numberText}>{sortOrder + 1}</Text>
|
|
) : (
|
|
<Ionicons name="flame-outline" size={18} color={Colors.primaryDark} />
|
|
)}
|
|
</View>
|
|
|
|
<View style={styles.titleContainer}>
|
|
<Text numberOfLines={2} style={styles.cardTitle}>
|
|
{title}
|
|
</Text>
|
|
</View>
|
|
|
|
<Ionicons name="chevron-forward" size={20} color="#9CA3AF" />
|
|
</Pressable>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
cardRow: {
|
|
minHeight: moderateScale(60),
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
padding: moderateScale(14),
|
|
backgroundColor: "#FFFFFF",
|
|
borderRadius: moderateScale(14),
|
|
borderWidth: 1,
|
|
borderColor: "#E2EAE5",
|
|
},
|
|
pressed: {
|
|
opacity: 0.72,
|
|
},
|
|
numberBadge: {
|
|
width: moderateScale(36),
|
|
height: moderateScale(36),
|
|
borderRadius: moderateScale(18),
|
|
backgroundColor: "#E8F5E9",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
numberText: {
|
|
fontSize: moderateScale(15),
|
|
fontWeight: "800",
|
|
color: Colors.primaryDark,
|
|
},
|
|
titleContainer: {
|
|
flex: 1,
|
|
marginLeft: moderateScale(12),
|
|
marginRight: moderateScale(8),
|
|
},
|
|
cardTitle: {
|
|
fontSize: moderateScale(15),
|
|
fontWeight: "600",
|
|
color: Colors.textPrimary,
|
|
},
|
|
});
|