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:
parent
87b2fde0af
commit
a283cd162b
@ -22,7 +22,7 @@ interface HomeProps {
|
|||||||
|
|
||||||
interface HomeState {
|
interface HomeState {
|
||||||
search?: string
|
search?: string
|
||||||
categoryAssets?: Array<any>
|
categoryAssets?: any[]
|
||||||
isLoadingCategory?: boolean
|
isLoadingCategory?: boolean
|
||||||
lastAssets?: any[]
|
lastAssets?: any[]
|
||||||
isLoadingLast?: boolean
|
isLoadingLast?: boolean
|
||||||
@ -33,7 +33,6 @@ const categories =
|
|||||||
formPublish.steps[1].fields.categories &&
|
formPublish.steps[1].fields.categories &&
|
||||||
formPublish.steps[1].fields.categories.options) ||
|
formPublish.steps[1].fields.categories.options) ||
|
||||||
[]
|
[]
|
||||||
]
|
|
||||||
|
|
||||||
class Home extends Component<HomeProps, HomeState> {
|
class Home extends Component<HomeProps, HomeState> {
|
||||||
public state = {
|
public state = {
|
||||||
@ -109,7 +108,6 @@ class Home extends Component<HomeProps, HomeState> {
|
|||||||
title={meta.title}
|
title={meta.title}
|
||||||
description={meta.description}
|
description={meta.description}
|
||||||
className={styles.home}
|
className={styles.home}
|
||||||
wide
|
|
||||||
>
|
>
|
||||||
<Content>
|
<Content>
|
||||||
<Form onSubmit={this.searchAssets} minimal>
|
<Form onSubmit={this.searchAssets} minimal>
|
||||||
|
@ -40,7 +40,12 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
const { search } = this.props.location
|
const { search } = this.props.location
|
||||||
|
.text
|
||||||
|
const searchPage = await queryString.parse(this.props.location.search)
|
||||||
|
.page
|
||||||
const { text, page, categories } = queryString.parse(search)
|
const { text, page, categories } = queryString.parse(search)
|
||||||
|
this.props.location.search
|
||||||
|
).categories
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
await this.setState({
|
await this.setState({
|
||||||
@ -79,6 +84,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
page: currentPage,
|
page: currentPage,
|
||||||
query: {
|
query: {
|
||||||
...queryValues,
|
...queryValues,
|
||||||
|
categories: [decodeURIComponent(searchCategories)],
|
||||||
price: [-1, 1]
|
price: [-1, 1]
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user