Skip to content

Commit

Permalink
feat: horizontal and vertical layouts for TabDataList
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvyShah committed Jul 20, 2022
1 parent db766df commit 744682f
Showing 1 changed file with 71 additions and 22 deletions.
93 changes: 71 additions & 22 deletions stories/reactivesearch/TabDataList.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,63 @@ import { ReactiveBase, ReactiveList, SelectedFilters, TabDataList } from "@appba

import { meetupList as MeetupList } from "./resultViews";

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
>
<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' },
]}
{...this.props}
/>
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"
Expand All @@ -36,7 +72,7 @@ export default class TabDataListDefault extends Component {
react={{
and: ["CitySensor"]
}}
{...this.props}
{...props}
>
{({ data }) => (
<ReactiveList.ResultListWrapper>
Expand All @@ -47,6 +83,19 @@ export default class TabDataListDefault extends Component {
)}
</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>
);
}
Expand Down

0 comments on commit 744682f

Please sign in to comment.