Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: Improve customization through render props #684

Merged
merged 14 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/maps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"emotion-theming": "^9.0.0",
"prop-types": "^15.6.0",
"react-emotion": "^9.0.0",
"react-google-maps": "^9.4.5"
"react-google-maps": "^9.4.5",
"rheostat": "^3.0.1"
metagrover marked this conversation as resolved.
Show resolved Hide resolved
},
"peerDependencies": {
"@appbaseio/reactivesearch": ">=2.8.2",
Expand Down
1 change: 0 additions & 1 deletion packages/native/example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Text, Header, Body, Title } from 'native-base';
import {
ReactiveBase,
DataSearch,
TextField,
SingleDropdownList,
MultiDropdownList,
SingleDropdownRange,
Expand Down
2 changes: 1 addition & 1 deletion packages/playground
2 changes: 1 addition & 1 deletion packages/web/examples/CategorySearch/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Main extends Component {
dataField="original_title"
from={0}
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/CustomSelectedFilters/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Main extends Component {
dataField="original_title"
from={0}
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/DataController/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
react={{
and: ['BookSensor'],
}}
Expand Down
4 changes: 2 additions & 2 deletions packages/web/examples/DataSearch/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Main extends Component {
componentId="SearchResult"
dataField="original_title"
size={10}
onData={this.onData}
renderData={this.renderData}
className="result-list-container"
pagination
react={{
Expand All @@ -42,7 +42,7 @@ class Main extends Component {
);
}

onData(data) {
renderData(data) {
return {
title: (
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/web/examples/DatePicker/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Main extends Component {
dataField="name"
from={0}
size={40}
onData={this.onData}
renderData={this.renderData}
showPagination
react={{
and: ['DateSensor'],
Expand Down Expand Up @@ -59,7 +59,7 @@ class Main extends Component {
return query;
}

onData(res) {
renderData(res) {
return {
image: res.image,
title: res.name,
Expand Down
4 changes: 2 additions & 2 deletions packages/web/examples/DateRange/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Main extends Component {
return query;
}

onData(res) {
renderData(res) {
return {
image: res.image,
title: res.name,
Expand Down Expand Up @@ -71,7 +71,7 @@ class Main extends Component {
dataField="name"
from={0}
size={40}
onData={this.onData}
renderData={this.renderData}
showPagination
react={{
and: ['DateSensor'],
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/DynamicRangeSlider/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class Main extends Component {
from={0}
size={3}
className="result-list-container"
onData={this.booksList}
renderData={this.booksList}
pagination
react={{
and: 'BookSensor',
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/MultiDataList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.meetupList}
renderData={this.meetupList}
innerClass={{
image: 'meetup-list-image',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/MultiDropdownList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
react={{
and: ['BookSensor'],
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/MultiDropdownRange/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Main extends Component {
dataField="original_title.raw"
from={0}
size={10}
onData={this.booksCard}
renderData={this.booksCard}
react={{
and: 'BookSensor',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/MultiList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
react={{
and: ['BookSensor'],
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/MultiRange/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Main extends Component {
dataField="original_title.raw"
from={0}
size={10}
onData={this.booksCard}
renderData={this.booksCard}
react={{
and: 'BookSensor',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/NumberBox/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Main extends Component {
dataField="original_title"
from={0}
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/RangeInput/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Main extends Component {
from={0}
size={3}
className="result-list-container"
onData={this.booksList}
renderData={this.booksList}
pagination
react={{
and: 'BookSensor',
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/RangeSlider/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Main extends Component {
from={0}
size={3}
className="result-list-container"
onData={this.booksList}
renderData={this.booksList}
pagination
react={{
and: 'BookSensor',
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/RatingsFilter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Main extends Component {
title="Results"
from={0}
size={20}
onData={this.onData}
renderData={this.onData}
react={{
and: 'RatingsSensor',
}}
Expand Down
4 changes: 2 additions & 2 deletions packages/web/examples/ReactiveComponent/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Main extends Component {
title="ReactiveList"
from={0}
size={20}
onData={this.onData}
renderData={this.renderData}
pagination
react={{
and: 'CarSensor',
Expand All @@ -60,7 +60,7 @@ class Main extends Component {
);
}

onData(data) {
renderData(data) {
return (
<div key={data._id}>
<h2>{data.name}</h2>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ReactiveList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Main extends Component {
dataField="original_title.raw"
className="result-list-container"
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
pagination
URLParams
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ResultCard/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Main extends Component {
componentId="SearchResult"
dataField="original_title.raw"
size={10}
onData={this.booksCard}
renderData={this.booksCard}
pagination
URLParams
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ResultList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Main extends Component {
componentId="SearchResult"
dataField="original_title"
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
URLParams
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SelectedFilters/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Main extends Component {
dataField="original_title"
from={0}
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SingleDataList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.meetupList}
renderData={this.meetupList}
innerClass={{
image: 'meetup-list-image',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SingleDropdownList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
react={{
and: ['BookSensor'],
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SingleDropdownRange/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Main extends Component {
dataField="original_title.raw"
from={0}
size={10}
onData={this.booksCard}
renderData={this.booksCard}
react={{
and: 'BookSensor',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SingleList/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.booksReactiveList}
renderData={this.booksReactiveList}
react={{
and: ['BookSensor'],
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/SingleRange/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Main extends Component {
dataField="original_title.raw"
from={0}
size={10}
onData={this.booksCard}
renderData={this.booksCard}
react={{
and: 'BookSensor',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/TagCloud/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.meetupList}
renderData={this.meetupList}
innerClass={{
image: 'meetup-list-image',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/TextField/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Main extends Component {
dataField="original_title"
from={0}
size={3}
onData={this.booksList}
renderData={this.booksList}
className="result-list-container"
pagination
react={{
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ToggleButton/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Main extends Component {
className="result-list-container"
from={0}
size={5}
onData={this.meetupList}
renderData={this.meetupList}
innerClass={{
image: 'meetup-list-image',
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ssr-with-react-dom/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const reactiveListProps = {
dataField: 'original_title.raw',
from: 0,
size: 10,
onData: data => <BookCard key={data._id} data={data} />,
renderData: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
Expand Down
21 changes: 13 additions & 8 deletions packages/web/examples/ssr-with-react-dom/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const reactiveListProps = {
dataField: 'original_title.raw',
from: 0,
size: 10,
onData: data => <BookCard key={data._id} data={data} />,
renderData: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
Expand Down Expand Up @@ -100,12 +100,16 @@ async function handleRender(req, res) {
// ReactiveSearch uses emotion and this will inline the styles
// so you can get the correct styles for ReactiveSearch's components
// on the first load
const html = renderStylesToString(renderToString(<App
store={store}
settings={settings}
singleRangeProps={singleRangeProps}
reactiveListProps={reactiveListProps}
/>));
const html = renderStylesToString(
renderToString(
<App
store={store}
settings={settings}
singleRangeProps={singleRangeProps}
reactiveListProps={reactiveListProps}
/>,
),
);

// Send the rendered page back to the client
res.send(renderFullPage(html, store));
Expand All @@ -119,6 +123,7 @@ app.listen(port, (error) => {
} else {
// eslint-disable-next-line
console.info(
`==> 🌎 Listening on port ${port}. Open up http://localhost:${port}/ in your browser.`);
`==> 🌎 Listening on port ${port}. Open up http://localhost:${port}/ in your browser.`,
);
}
});
2 changes: 1 addition & 1 deletion packages/web/examples/ssr/pages/categorysearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const reactiveListProps = {
className: 'result-list-container',
from: 0,
size: 5,
onData: data => <BookCard key={data._id} data={data} />,
renderData: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ssr/pages/datasearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const reactiveListProps = {
className: 'result-list-container',
from: 0,
size: 5,
onData: data => <BookCard key={data._id} data={data} />,
renderData: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/web/examples/ssr/pages/dynamicrangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const reactiveListProps = {
dataField: 'original_title.raw',
from: 0,
size: 10,
onData: data => <BookCard key={data._id} data={data} />,
renderData: data => <BookCard key={data._id} data={data} />,
react: {
and: ['BookSensor'],
},
Expand Down