-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apply filters to Categories as well (#30)
- Loading branch information
Showing
7 changed files
with
20 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
module.exports = { | ||
...require('@smartive/prettier-config'), | ||
} |
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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import { SearchWithResults } from '../compositions/search-with-results'; | ||
import { getClient } from '../services/mongo'; | ||
|
||
export async function getServerSideProps(context) { | ||
const client = await getClient(); | ||
const categories = await client.db('shops').collection('shops').distinct('categories'); | ||
client.close(); | ||
|
||
return { | ||
props: { query: context.query, categories }, | ||
props: { query: context.query }, | ||
}; | ||
} | ||
|
||
export default ({ query, categories }) => { | ||
return <SearchWithResults categories={categories} query={query} />; | ||
export default ({ query }) => { | ||
return <SearchWithResults query={query} />; | ||
}; |
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 |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { useRouter } from 'next/router'; | ||
import { SearchWithResults } from '../compositions/search-with-results'; | ||
import { Stacked } from '../layout/stacked'; | ||
import { getClient } from '../services/mongo'; | ||
|
||
export async function getServerSideProps() { | ||
const client = await getClient(); | ||
const categories = await client.db('shops').collection('shops').distinct('categories'); | ||
client.close(); | ||
|
||
return { | ||
props: { categories }, | ||
}; | ||
} | ||
|
||
export default ({ categories }) => { | ||
export default () => { | ||
const { query } = useRouter(); | ||
return ( | ||
<Stacked title="Anbieter und Angebote - Emma bringts!"> | ||
<SearchWithResults categories={categories} query={query} /> | ||
<SearchWithResults query={query} /> | ||
</Stacked> | ||
); | ||
}; |
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
6f1cfe7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: