-
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.
set up view pages for similar, uses, and twins
- Loading branch information
1 parent
46d1da7
commit 97948b4
Showing
4 changed files
with
138 additions
and
48 deletions.
There are no files selected for viewing
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,60 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import axios from 'axios'; | ||
import SearchHeader from '../SearchHeader/SearchHeader'; | ||
import ResultTable from './ResultTable/ResultTable'; | ||
import styles from '../../../styles/view.module.css'; | ||
import TopLevel from '../../TopLevel'; | ||
import NavbarSearch from '../NavbarSearch/NavbarSearch'; | ||
|
||
export default function search(properties) { | ||
const [Data, setData] = useState(null); | ||
const [error, setError] = useState(null); | ||
|
||
useEffect(() => { | ||
axios.get(`${properties.url}`, { | ||
headers: { | ||
"Content-Type": "application/json; charset=UTF-8", | ||
"Accept": "application/json" | ||
} | ||
}) | ||
.then(response => { | ||
setData(response.data); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching twins: ', error); | ||
setError(error); | ||
}); | ||
}, []); | ||
|
||
if (error) { | ||
return <div>Error loading searched data.</div>; | ||
} | ||
|
||
if (!Data) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
return ( | ||
<TopLevel | ||
doNotTrack={true} | ||
navbar={ | ||
<NavbarSearch | ||
value={properties.uri} | ||
placeholder="Search SynBioHub" | ||
onChange={event => { | ||
dispatch(setSearchQuery(event.target.value)); | ||
dispatch(setOffset(0)); | ||
}} | ||
/> | ||
} | ||
hideFooter={true} | ||
publicPage={true} | ||
> | ||
<div className={styles.searchContent}> | ||
<SearchHeader selected="Standard Search" /> | ||
<ResultTable count={Data.length} data={Data} /> | ||
</div> | ||
</TopLevel> | ||
|
||
); | ||
} |
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
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 +1 @@ | ||
e29b11b511fdde65acd45d974167b43607b1a9a8 | ||
46d1da7df47db1236a696eb39e3a6607b1f78e6d |