74 |
75 | setSearchTerm(e.target.value)}
79 | placeholder="Search blocks or paste repo URL"
80 | className={tw("!pl-2 w-full")}
81 | />
82 |
83 | {status === "loading" ? (
84 |
85 |
86 | {isSearchTermUrl ? (
87 | <>
88 | Loading Blocks from the{" "}
89 |
90 | {searchTermOwner}/{searchTermRepo}
91 | {" "}
92 | repository
93 | >
94 | ) : "Loading..."}
95 |
96 |
97 | ) : status === "error" ? (
98 |
99 |
100 | {isSearchTermUrl ? (
101 | <>
102 | We weren't able to find the{" "}
103 |
104 | {searchTermOwner}/{searchTermRepo}
105 | {" "}
106 | repo. If it's private, make sure our GitHub App has access to it.
107 | >
108 | ) : "We weren't able to find any Blocks matching your search."}
109 |
110 |
111 | ) : !blocks?.length ? (
112 |
113 |
114 | {isSearchTermUrl ? (
115 | <>
116 | We weren't able to find any Blocks in{" "}
117 |
118 | {searchTermOwner}/{searchTermRepo}
119 |
120 | .
121 | >
122 | ) : "We weren't able to find any Blocks matching your search."}
123 |
124 |
125 | ) : (
126 |
127 | {/* @ts-ignore */}
128 |
129 |
130 | {blocks.map((block) => {
131 | return (
132 | {
138 | onChange(block);
139 | setIsOpen(false);
140 | setSearchTerm("");
141 | }}
142 | />
143 | );
144 | })}
145 |
146 |
147 |
148 | )}
149 |
150 |