mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import {
|
|
Children,
|
|
cloneElement,
|
|
isValidElement,
|
|
type PropsWithChildren,
|
|
type ReactElement,
|
|
} from "react";
|
|
import { StyleSheet, View, type ViewProps, type ViewStyle } from "react-native";
|
|
import { Text } from "../common/Text";
|
|
|
|
interface Props extends ViewProps {
|
|
title?: string | null | undefined;
|
|
description?: ReactElement;
|
|
}
|
|
|
|
export const ListGroup: React.FC<PropsWithChildren<Props>> = ({
|
|
title,
|
|
children,
|
|
description,
|
|
...props
|
|
}) => {
|
|
const childrenArray = Children.toArray(children);
|
|
|
|
return (
|
|
<View {...props}>
|
|
<Text className='ml-4 mb-1 uppercase text-[#8E8D91] text-xs'>
|
|
{title}
|
|
</Text>
|
|
<View
|
|
style={[]}
|
|
className='flex flex-col rounded-xl overflow-hidden pl-0 bg-neutral-900'
|
|
>
|
|
{Children.map(childrenArray, (child, index) => {
|
|
if (isValidElement<{ style?: ViewStyle }>(child)) {
|
|
return cloneElement(child as any, {
|
|
style: StyleSheet.compose(
|
|
child.props.style,
|
|
index < childrenArray.length - 1
|
|
? styles.borderBottom
|
|
: undefined,
|
|
),
|
|
});
|
|
}
|
|
return child;
|
|
})}
|
|
</View>
|
|
{description && <View className='pl-4 mt-1'>{description}</View>}
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
borderBottom: {
|
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
borderBottomColor: "#3D3C40",
|
|
},
|
|
});
|