Skip to content

Commit

Permalink
Add header prop
Browse files Browse the repository at this point in the history
  • Loading branch information
dtun committed Aug 18, 2024
1 parent 1f1c975 commit e2d4d7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ function Main() {
<ListContainer
style={[styles.container, { paddingTop: top, paddingBottom: bottom }]}
>
<MyMenuView menuData={menuData.filter((i) => i.checked)} />
<MyMenuView
headerTitle="My Music"
menuData={menuData.filter((i) => i.checked)}
/>
<Controls
level={level}
playing={playing}
Expand Down
10 changes: 8 additions & 2 deletions components/MyMenuView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import { MyMenuViewItem } from "@/components/MyMenuViewItem";

import type { MenuItem } from "@/types";

export function MyMenuView({ menuData }: { menuData: MenuItem[] }) {
export function MyMenuView({
headerTitle,
menuData,
}: {
headerTitle: string;
menuData: MenuItem[];
}) {
return (
<FlatList
contentContainerStyle={styles.listContent}
Expand All @@ -17,7 +23,7 @@ export function MyMenuView({ menuData }: { menuData: MenuItem[] }) {
ListFooterComponent={<View style={styles.footer} />}
ListHeaderComponent={
<View style={styles.header}>
<Text style={styles.headerTitle}>My Music</Text>
<Text style={styles.headerTitle}>{headerTitle}</Text>
<Link href="/edit">
<Text>Edit</Text>
</Link>
Expand Down

0 comments on commit e2d4d7e

Please sign in to comment.