You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Sanity App SDK Explorer contains an assortment of example interfaces built with our React SDK’s hooks. The purpose of the Explorer is to demonstrate how these hooks can be used to build out interfaces powered by Sanity, with a variety of approaches to styling.
We couldn’t find any movies with content matching the search term ‘{search}’. Try something
64
+
else?
65
+
</Card>
66
+
)
67
+
}
68
+
69
+
functionResults(){
70
+
returnmovies.map((movie)=>(
71
+
<Suspensekey={movie.documentId}>
72
+
<DocumentResultdocumentHandle={movie}/>
73
+
</Suspense>
74
+
))
75
+
}
76
+
77
+
letComponent
78
+
79
+
if(search===''){
80
+
Component=EmptyState
81
+
}elseif(count===0){
82
+
Component=NoResults
83
+
}elseComponent=Results
84
+
52
85
return(
53
86
<ExampleLayout
54
87
title="Document search"
@@ -57,7 +90,7 @@ export default function DocumentSearch(): JSX.Element {
57
90
styling="Sanity UI"
58
91
summary="This example passes a state variable to the useDocuments hook’s ‘search’ argument, enabling the creation of a dynamic search interface for documents in the targeted dataset(s). (Note: the ‘search’ parameter currently searches for matches across all of a document’s string fields.)"
59
92
>
60
-
<Stackspace={5}>
93
+
<Stackspace={5}marginBottom={4}>
61
94
<Stackspace={3}>
62
95
<LabelhtmlFor="movieSearch">Enter your search term:</Label>
63
96
{/* Use a search input to set the value of the `search` state variable */}
@@ -71,13 +104,7 @@ export default function DocumentSearch(): JSX.Element {
0 commit comments