fix(SW-1446): make clear history action work, reduces complexity and improves separation of concerns
This commit is contained in:
@@ -5,5 +5,4 @@ export type ClientProps = {
|
||||
latest: NonNullable<LocationMatchResultsState>
|
||||
setFilterString: (filter: string | null) => void
|
||||
onAction: JumpToProps<JumpToData>["onAction"]
|
||||
onClearHistory: () => void
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { Key } from "react-aria-components"
|
||||
|
||||
export type JumpToDataItem = {
|
||||
id: string
|
||||
id: Key
|
||||
displayName: string
|
||||
type: "hotels" | "cities"
|
||||
description: string
|
||||
@@ -15,7 +17,7 @@ export type JumpToHistory = {
|
||||
type: JumpToDataItem["type"]
|
||||
}[]
|
||||
|
||||
export type JumpToProps<T extends { id: string }[]> = {
|
||||
export type JumpToProps<T extends { id: Key }[]> = {
|
||||
data: T
|
||||
history: JumpToHistory
|
||||
onAction: (id: T[number]["id"]) => void
|
||||
@@ -23,7 +25,7 @@ export type JumpToProps<T extends { id: string }[]> = {
|
||||
}
|
||||
|
||||
export type LocationMatch = {
|
||||
id: string
|
||||
id: Key
|
||||
displayName: string
|
||||
type: string
|
||||
description?: string
|
||||
@@ -35,7 +37,7 @@ export type ScoringMatch = LocationMatch & {
|
||||
}
|
||||
|
||||
export type LocationMatchResult = {
|
||||
id: string
|
||||
id: Key
|
||||
name: string
|
||||
children: LocationMatch[]
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import type { ClientProps } from "./client"
|
||||
|
||||
export type ResultHistoryProps = Pick<ClientProps, "onClearHistory"> & {
|
||||
results: ClientProps["latest"]
|
||||
}
|
||||
|
||||
export type ResultMatchesProps = Pick<ClientProps, "onAction"> & {
|
||||
export type ResultsProps = Pick<ClientProps, "onAction"> & {
|
||||
results: NonNullable<ClientProps["results"]>
|
||||
"aria-label": string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user