1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

category search, make multiple layouts on one page possible

This commit is contained in:
Matthias Kretschmann 2019-05-15 16:45:32 +02:00
parent 87b2fde0af
commit a283cd162b
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ interface HomeProps {
interface HomeState {
search?: string
categoryAssets?: Array<any>
categoryAssets?: any[]
isLoadingCategory?: boolean
lastAssets?: any[]
isLoadingLast?: boolean
@ -33,7 +33,6 @@ const categories =
formPublish.steps[1].fields.categories &&
formPublish.steps[1].fields.categories.options) ||
[]
]
class Home extends Component<HomeProps, HomeState> {
public state = {
@ -109,7 +108,6 @@ class Home extends Component<HomeProps, HomeState> {
title={meta.title}
description={meta.description}
className={styles.home}
wide
>
<Content>
<Form onSubmit={this.searchAssets} minimal>

View File

@ -40,7 +40,12 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
public async componentDidMount() {
const { search } = this.props.location
.text
const searchPage = await queryString.parse(this.props.location.search)
.page
const { text, page, categories } = queryString.parse(search)
this.props.location.search
).categories
if (text) {
await this.setState({
@ -79,6 +84,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
page: currentPage,
query: {
...queryValues,
categories: [decodeURIComponent(searchCategories)],
price: [-1, 1]
},
sort: {