Files
otunes/apps/mobile/components/collection-list.tsx
T

51 lines
1.2 KiB
TypeScript

import { PaletteText } from "@/components/palette-text"
import { memo } from "react"
import { StyleSheet, View } from "react-native"
import { useThemeColors } from "@/lib/theme"
/** Horizontal inset for rows and dividers in album and playlist track lists. */
export const collectionInset = 20
/** Separates a collection's header from its track list. */
export function CollectionDivider({ color }: { color?: string }) {
const colors = useThemeColors()
return (
<View
style={[styles.divider, { backgroundColor: color ?? colors.border }]}
/>
)
}
export const DiscHeader = memo(function DiscHeader({
label,
color,
}: {
label: string
color?: string
}) {
const colors = useThemeColors()
return (
<PaletteText
tone={color ? "foreground" : undefined}
style={[styles.discHeader, { color: color ?? colors.foreground }]}
>
{label}
</PaletteText>
)
})
const styles = StyleSheet.create({
divider: {
height: StyleSheet.hairlineWidth,
marginHorizontal: collectionInset,
},
discHeader: {
fontSize: 17,
fontWeight: "700",
paddingHorizontal: collectionInset,
paddingTop: 24,
paddingBottom: 8,
},
})