@@ -18,12 +18,17 @@ class Search extends Component {
18 this.onSelect = this.onSelect.bind(this);
18 this.onSelect = this.onSelect.bind(this);
19 this.glossarySearch = this.glossarySearch.bind(this);
19 this.glossarySearch = this.glossarySearch.bind(this);
20 this.patpSearch = this.patpSearch.bind(this);
20 this.patpSearch = this.patpSearch.bind(this);
21+ this.devSearch = this.devSearch.bind(this);
23 searchEndpoint(query) {
24 searchEndpoint(query) {
24 return `/api/search?q=${query}`;
25 return `/api/search?q=${query}`;
29+ return `/api/dev-search?q=${query}`;
27 glossarySearch(query) {
32 glossarySearch(query) {
28 const entries = glossary.filter((entry) => {
33 const entries = glossary.filter((entry) => {
@@ -54,12 +59,11 @@ class Search extends Component {
54 this.props.closeSearch();
59 this.props.closeSearch();
57− onInputValueChange = debounce((query) => {
62+ onInputValueChange = debounce(async (query) => {
58 if (query.length) {
63 if (query.length) {
59 fetch(this.searchEndpoint(query))
64 fetch(this.searchEndpoint(query))
60 .then((res) => res.json())
65 .then((res) => res.json())
61− .then((res) => {
66+ .then(async (res) => {
63 // Wrap results in an object which will tell React what component to use to render results.
67 // Wrap results in an object which will tell React what component to use to render results.
64 const results = res.results.map((item) => ({
68 const results = res.results.map((item) => ({
65 type: "RESULT",
69 type: "RESULT",
@@ -89,7 +93,21 @@ class Search extends Component {
89 content: item,
93 content: item,
96+ const devResults = await fetch(this.devSearch(query))
97+ .then((res) => res.json())
99+ return res.results.map((item) => ({
92− const list = [...glossaryResults, ...patpResult, ...results];
106+ ...glossaryResults,
94 this.setState({ results: list });
112 this.setState({ results: list });
@@ -254,6 +272,47 @@ class Search extends Component {
275+ if (item.type === "DEV_RESULT") {
276+ const devItem = Object.assign({}, item.content);
279+ ] = `https://developers.urbit.org${item.content.slug}`;
282+ className={`cursor-pointer flex text-left w-full ${
283+ selected ? "bg-green-400" : ""
286+ key: item.content.link + "-" + index,
292+ <div className="p-3">
294+ className={`font-medium text-base ${
295+ selected ? "text-white" : "text-wall-600"
298+ <span className="text-wall-400">
299+ {item.content.parent !== "Content"
300+ ? `developers.urbit.org / ${item.content.parent} /`
301+ : "developers.urbit.org /"}{" "}
303+ {item.content.title}
306+ className={`text-base font-regular text-small ${
307+ selected ? "text-midWhite" : "text-wall-500"
310+ {item.content.content}
257 return null;
316 return null;