) => {
+ const selectedValue = (e.target as Element).textContent;
+
+ if (!selectedValue) return;
+ if (selected === selectedValue) return;
+
+ setSelected(selectedValue);
+ };
+
+ return (
+
+
+
+ {options.map(option => (
+
+ {option.label}
+
+ ))}
+
+ {children({ selected })}
+
+
+ );
+}
diff --git a/src/components/match/RecordItem/index.tsx b/src/components/match/RecordItem/index.tsx
new file mode 100644
index 0000000..682d7df
--- /dev/null
+++ b/src/components/match/RecordItem/index.tsx
@@ -0,0 +1,18 @@
+import { MatchRecordsType } from '@/types/match';
+
+export default function RecordItem({
+ playerName,
+ score,
+ scoredAt,
+ teamName,
+}: MatchRecordsType) {
+ return (
+
+
+ [ {teamName} ]
+
+ {playerName} 선수 {score}점 득점 🎉
+
+
+ );
+}
diff --git a/src/components/match/RecordList/index.tsx b/src/components/match/RecordList/index.tsx
new file mode 100644
index 0000000..e78d5b7
--- /dev/null
+++ b/src/components/match/RecordList/index.tsx
@@ -0,0 +1,19 @@
+import { MatchTimelineType } from '@/types/match';
+
+import RecordItem from '../RecordItem';
+
+export default function RecordList({
+ gameQuarter,
+ records,
+}: MatchTimelineType) {
+ return (
+ <>
+ {gameQuarter}
+
+ {records.map(record => (
+
+ ))}
+
+ >
+ );
+}
diff --git a/src/components/match/Video/index.tsx b/src/components/match/Video/index.tsx
new file mode 100644
index 0000000..b937cc2
--- /dev/null
+++ b/src/components/match/Video/index.tsx
@@ -0,0 +1,11 @@
+export default function Video() {
+ return (
+
+ );
+}
diff --git a/src/queries/useMatchLineupById/Fetcher.tsx b/src/queries/useMatchLineupById/Fetcher.tsx
new file mode 100644
index 0000000..5c9961d
--- /dev/null
+++ b/src/queries/useMatchLineupById/Fetcher.tsx
@@ -0,0 +1,21 @@
+import { ReactNode } from 'react';
+
+import { MatchLineupType } from '@/types/match';
+
+import { useMatchLineupById } from './query';
+
+type MatchLineupFetcherProps = {
+ matchId: string;
+ children: (data: MatchLineupType[]) => ReactNode;
+};
+
+export default function MatchLineupFetcher({
+ matchId,
+ children,
+}: MatchLineupFetcherProps) {
+ const { lineup, error } = useMatchLineupById(matchId);
+
+ if (error) throw error;
+
+ return children(lineup);
+}
diff --git a/src/queries/useMatchLineupById/query.ts b/src/queries/useMatchLineupById/query.ts
new file mode 100644
index 0000000..a74ec70
--- /dev/null
+++ b/src/queries/useMatchLineupById/query.ts
@@ -0,0 +1,15 @@
+import { useSuspenseQuery } from '@tanstack/react-query';
+
+import { getMatchLineupById } from '@/api/match';
+
+export const useMatchLineupById = (matchId: string) => {
+ const { data, error } = useSuspenseQuery({
+ queryKey: ['match-lineup', matchId],
+ queryFn: () => getMatchLineupById(matchId),
+ });
+
+ return {
+ lineup: data,
+ error,
+ };
+};
diff --git a/src/queries/useMatchTimelineById/Fetcher.tsx b/src/queries/useMatchTimelineById/Fetcher.tsx
new file mode 100644
index 0000000..a16483f
--- /dev/null
+++ b/src/queries/useMatchTimelineById/Fetcher.tsx
@@ -0,0 +1,31 @@
+import { ReactNode } from 'react';
+
+import { useMatchTimelineById } from './query';
+
+type MatchRecordsType = {
+ scoredAt: number;
+ playerName: string;
+ teamName: string;
+ score: number;
+};
+
+type MatchTimelineType = {
+ gameQuarter: string;
+ records: MatchRecordsType[];
+};
+
+type MatchTimelineFetcherProps = {
+ matchId: string;
+ children: (data: MatchTimelineType[]) => ReactNode;
+};
+
+export default function MatchTimelineFetcher({
+ matchId,
+ children,
+}: MatchTimelineFetcherProps) {
+ const { timeline, error } = useMatchTimelineById(matchId);
+
+ if (error) throw error;
+
+ return children(timeline);
+}
diff --git a/src/queries/useMatchTimelineById/query.ts b/src/queries/useMatchTimelineById/query.ts
new file mode 100644
index 0000000..d804cf5
--- /dev/null
+++ b/src/queries/useMatchTimelineById/query.ts
@@ -0,0 +1,17 @@
+import { useSuspenseQuery } from '@tanstack/react-query';
+
+import { getMatchTimelineById } from '@/api/match';
+
+export const useMatchTimelineById = (matchId: string) => {
+ const { data, error } = useSuspenseQuery({
+ queryKey: ['match-timeline', matchId],
+ queryFn: () => getMatchTimelineById(matchId),
+ });
+
+ if (error) throw error;
+
+ return {
+ timeline: data,
+ error,
+ };
+};
diff --git a/src/types/match.ts b/src/types/match.ts
index 4c1ac02..62ce89e 100644
--- a/src/types/match.ts
+++ b/src/types/match.ts
@@ -39,7 +39,7 @@ export type MatchRecordsType = {
};
export type MatchTimelineType = {
- gameQuater: MatchQuarterType;
+ gameQuarter: MatchQuarterType;
records: MatchRecordsType[];
};