diff --git a/components/search/Input.tsx b/components/search/Input.tsx
new file mode 100644
index 00000000..a2406e79
--- /dev/null
+++ b/components/search/Input.tsx
@@ -0,0 +1,33 @@
+import { useState } from 'react'
+import { useRouter } from 'next/router'
+import Link from 'next/link'
+
+export default function Input({ query }) {
+ const router = useRouter()
+ const [q, setQ] = useState(query.q)
+
+ const handleChange = (event) => {
+ setQ(event.target.value)
+ }
+
+ const handleSubmit = (event) => {
+ event.preventDefault()
+ router.push({
+ pathname: '/search',
+ query: { q },
+ })
+ }
+
+ return (
+
+ )
+}
diff --git a/components/search/Item.tsx b/components/search/Item.tsx
new file mode 100644
index 00000000..4658621d
--- /dev/null
+++ b/components/search/Item.tsx
@@ -0,0 +1,21 @@
+import Link from 'next/link'
+
+export default function Item({ datapackage }) {
+ return (
+
+ )
+}
diff --git a/components/search/List.tsx b/components/search/List.tsx
new file mode 100644
index 00000000..918bd343
--- /dev/null
+++ b/components/search/List.tsx
@@ -0,0 +1,9 @@
+import Item from './Item'
+
+export default function List({ datapackages }) {
+ return (
+
+ {datapackages.map((datapackage, index) => )}
+
+ )
+}
diff --git a/components/search/Sort.tsx b/components/search/Sort.tsx
new file mode 100644
index 00000000..578b6776
--- /dev/null
+++ b/components/search/Sort.tsx
@@ -0,0 +1,14 @@
+export default function Sort({ selected }) {
+ return (
+
+
+
+
+ )
+}
diff --git a/components/search/Total.tsx b/components/search/Total.tsx
new file mode 100644
index 00000000..e26a3178
--- /dev/null
+++ b/components/search/Total.tsx
@@ -0,0 +1,3 @@
+export default function Total({ total }) {
+ return { total } results found
+}
diff --git a/pages/search.tsx b/pages/search.tsx
new file mode 100644
index 00000000..d57b8397
--- /dev/null
+++ b/pages/search.tsx
@@ -0,0 +1,34 @@
+import { GetServerSideProps } from 'next'
+import querystring from 'querystring'
+import config from '../config'
+import utils from '../utils'
+import Input from '../components/search/Input'
+import Total from '../components/search/Total'
+import Sort from '../components/search/Sort'
+import List from '../components/search/List'
+
+function Search({ ckanResult, datapackages, query }) {
+ return (
+
+
+
+
+
+
+ )
+}
+
+export const getServerSideProps: GetServerSideProps = async (context) => {
+ const query = context.query || {}
+ const ckanQuery = querystring.stringify(
+ utils.convertToCkanSearchQuery(query)
+ )
+ console.log(ckanQuery)
+ const res = await fetch(`${config.get('DMS')}/api/3/action/package_search?${ckanQuery}`)
+ const ckanResult = (await res.json()).result
+ const datapackages = ckanResult.results.map(item => utils.ckanToDataPackage(item))
+
+ return { props: { ckanResult, datapackages, query } }
+}
+
+export default Search