@@ -24,3 +24,48 @@ and include some instructions on running.
2424- Configure your credentials in ` config/engine.json `
2525- Run ` yarn `
2626- Run ` yarn start `
27+
28+ ## Component Structure
29+
30+ This project is structure in such a way that it mimics the eventual setup
31+ of our UI toolkit.
32+
33+ For example:
34+
35+ ``` jsx
36+ < AppSearchProvider driver= {new AppSearchDriver (config)}>
37+ < div className= " App" >
38+ < SearchBox / >
39+ < Meta / >
40+ < Results / >
41+ < / div>
42+ < / AppSearchProvider>
43+ ```
44+
45+ ` AppSearchProvider ` - The "Provider" is configured at the top level of your App.
46+ You pass it an instance of ` AppSearchDriver ` , which is configured for your
47+ account and engine. This "Provider" uses React's "Context" API to hold state
48+ and expose that state to other App Search components in the component tree.
49+ ` AppSearchDriver ` - Non-React "driver" class. The idea is to hold all non-React
50+ specific logic here, so that it can be shared across multiple toolkits
51+ ` containers/{SearchBox,Meta,Results} ` - These are individual "Connected" App
52+ Search Components. They are aware of state provided by AppSearchProvider and can
53+ update that state as well. They have no "View" of their own, they simply hold
54+ the logic. This means that any "View" component could be swapped in.
55+
56+ Not shown above, but included in this project:
57+
58+ ` components/{SearchBox,Meta,Results,Result ` - These are individual "View"
59+ components. They have no logic and are not aware of App Search. They simply take
60+ simple properties are render them. These would be the "default" views for
61+ UI Toolkit, but could be easily swapped out.
62+ ` app-search/withAppSearch ` - A higher order component that a Toolkit user could
63+ use to connect any component to the App Search state. This enables users to
64+ write their own components.
65+
66+ ## TODO
67+
68+ - [ ] Paging
69+ - [ ] URL State
70+ - [ ] Configurable fields
71+ - [ ] Snippets
0 commit comments