Skip to content

Commit

Permalink
feat(places): add Places widget (#4167)
Browse files Browse the repository at this point in the history
* feat(places): add Places widget

* fix(places): rename `placesClient` to `placesReference`
  • Loading branch information
francoischalifour authored and Haroenv committed Oct 23, 2019
1 parent 80d32fc commit 1d754d1
Show file tree
Hide file tree
Showing 9 changed files with 703 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .storybook/static/storybook.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ body {

.algolia-places {
display: block !important;
width: 850px;
width: 100%;
margin: 0 auto;
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"jscodeshift": "0.6.4",
"jsdom-global": "3.0.2",
"mversion": "1.13.0",
"places.js": "1.16.4",
"places.js": "1.16.6",
"prettier": "1.18.2",
"rollup": "1.21.4",
"rollup-plugin-babel": "4.3.3",
Expand All @@ -139,7 +139,7 @@
"bundlesize": [
{
"path": "./dist/instantsearch.production.min.js",
"maxSize": "62 kB"
"maxSize": "63 kB"
},
{
"path": "./dist/instantsearch.development.js",
Expand Down
10 changes: 10 additions & 0 deletions src/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ export type IndexUiState = {
page?: number;
hitsPerPage?: number;
configure?: PlainSearchParameters;
places?: {
query: string;
/**
* The central geolocation.
*
* @example '48.8546,2.3477'
*/
position: string;
};
};

export type UiState = {
Expand All @@ -130,6 +139,7 @@ export interface Widget {
| 'ais.menu'
| 'ais.numericMenu'
| 'ais.pagination'
| 'ais.places'
| 'ais.poweredBy'
| 'ais.queryRules'
| 'ais.range'
Expand Down
1 change: 1 addition & 0 deletions src/widgets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export {
default as queryRuleContext,
} from './query-rule-context/query-rule-context';
export { default as index } from './index/index';
export { default as places } from './places/places';
1 change: 1 addition & 0 deletions src/widgets/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ const index = (props: IndexProps): Index => {
page: ['ais.pagination', 'ais.infiniteHits'],
hitsPerPage: ['ais.hitsPerPage'],
configure: ['ais.configure'],
places: ['ais.places'],
};

const mountedWidgets = this.getWidgets()
Expand Down
Loading

0 comments on commit 1d754d1

Please sign in to comment.