forked from 5monkeys/djedi-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearch.js
More file actions
24 lines (23 loc) · 739 Bytes
/
Search.js
File metadata and controls
24 lines (23 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Node } from "djedi-react";
import React from "react";
export default function Search() {
return (
<Node
uri="Search/placeholder"
// `edit={false}` makes `state.content` a string instead of a <span>.
edit={false}
// Use a custom render function to put the node content in the
// `placeholder` attribute. `<input placeholder={<Node uri="..."/>}` />`
// won’t work because `<Tag>` always returns an object in React.
render={state => (
<input
type="search"
// Ignore loading and error states and show the content if available.
placeholder={state.type === "success" ? state.content : ""}
/>
)}
>
Search
</Node>
);
}