-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from appbaseio/feat/tab-data-list
Feat/tab data list
- Loading branch information
Showing
3 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React, { Component } from "react"; | ||
import { ReactiveBase, ReactiveList, SelectedFilters, TabDataList } from "@appbaseio/reactivesearch"; | ||
|
||
import { meetupList as MeetupList } from "./resultViews"; | ||
|
||
const HorizontalLayout = (props) =>( | ||
<div className="container"> | ||
<SelectedFilters /> | ||
<TabDataList | ||
componentId="CitySensor" | ||
dataField="group.group_topics.topic_name_raw.keyword" | ||
data={[ | ||
{ label: 'Open Source', value: 'Open Source' }, | ||
{ label: 'Social', value: 'Social' }, | ||
{ label: 'Adventure', value: 'Adventure' }, | ||
{ label: 'Music', value: 'Music' }, | ||
]} | ||
{...props} | ||
/> | ||
<ReactiveList | ||
componentId="SearchResult" | ||
dataField="group.group_topics.topic_name_raw.keyword" | ||
title="Results" | ||
sortBy="asc" | ||
className="result-list-container" | ||
from={0} | ||
size={5} | ||
pagination | ||
react={{ | ||
and: ["CitySensor"] | ||
}} | ||
{...props} | ||
> | ||
{({ data }) => ( | ||
<ReactiveList.ResultListWrapper> | ||
{ | ||
data.map(item => <MeetupList {...item} />) | ||
} | ||
</ReactiveList.ResultListWrapper> | ||
)} | ||
</ReactiveList> | ||
</div> | ||
) | ||
|
||
const VerticalLayout = (props)=>( | ||
<> | ||
<SelectedFilters /> | ||
<div className="row"> | ||
<div className="col"> | ||
<TabDataList | ||
componentId="CitySensor" | ||
dataField="group.group_topics.topic_name_raw.keyword" | ||
data={[ | ||
{ label: 'Open Source', value: 'Open Source' }, | ||
{ label: 'Social', value: 'Social' }, | ||
{ label: 'Adventure', value: 'Adventure' }, | ||
{ label: 'Music', value: 'Music' }, | ||
]} | ||
{...props} | ||
/> | ||
</div> | ||
<div className="col"> | ||
<ReactiveList | ||
componentId="SearchResult" | ||
dataField="group.group_topics.topic_name_raw.keyword" | ||
title="Results" | ||
sortBy="asc" | ||
className="result-list-container" | ||
from={0} | ||
size={5} | ||
pagination | ||
react={{ | ||
and: ["CitySensor"] | ||
}} | ||
{...props} | ||
> | ||
{({ data }) => ( | ||
<ReactiveList.ResultListWrapper> | ||
{ | ||
data.map(item => <MeetupList {...item} />) | ||
} | ||
</ReactiveList.ResultListWrapper> | ||
)} | ||
</ReactiveList> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
|
||
export default class TabDataListDefault extends Component { | ||
render() { | ||
return ( | ||
<ReactiveBase | ||
app="meetup_app" | ||
url="https://a03a1cb71321:75b6603d-9456-4a5a-af6b-a487b309eb61@appbase-demo-ansible-abxiydt-arc.searchbase.io" | ||
enableAppbase | ||
> | ||
{this.props.displayAsVertical ? <VerticalLayout {...this.props}/>: <HorizontalLayout {...this.props}/>} | ||
</ReactiveBase> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters