-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from pshenmic/feat/data_contract_schema
Add data contracts page
- Loading branch information
Showing
5 changed files
with
79 additions
and
1 deletion.
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
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
45 changes: 45 additions & 0 deletions
45
packages/frontend/src/routes/dataContracts/data.contracts.route.js
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,45 @@ | ||
import React, {useEffect, useState} from 'react'; | ||
import './data_contracts.css' | ||
import * as Api from '../../util/Api' | ||
import {Link} from "react-router-dom"; | ||
|
||
function DataContracts({dataContracts}) { | ||
return <div className={"data_contracts_list"}> | ||
{ | ||
dataContracts.map((dataContract) => | ||
<DataContract | ||
key={dataContract.identifier} | ||
dataContract={dataContract}/>) | ||
} | ||
</div> | ||
} | ||
|
||
function DataContract({dataContract}) { | ||
return <div className={"data_contracts_item"}> | ||
<Link to={`/dataContracts/${dataContract.identifier}`}>{dataContract.identifier}</Link> | ||
</div> | ||
} | ||
|
||
function DataContractsRoute() { | ||
const [dataContracts, setDataContracts] = useState(null) | ||
const [loading, setLoading] = useState(null) | ||
const [error, setError] = useState(null) | ||
|
||
|
||
useEffect(() => { | ||
Api.getDataContracts() | ||
.then((dataContracts) => setDataContracts(dataContracts)) | ||
.catch((err) => { | ||
setError(err) | ||
}) | ||
.finally(() => setLoading(false)) | ||
}, []) | ||
|
||
return (<div className="container"> | ||
{error && <div>Error {error}</div>} | ||
{loading && <div>Loading data contracts from API</div>} | ||
{dataContracts && <DataContracts dataContracts={dataContracts}/>} | ||
</div>); | ||
} | ||
|
||
export default DataContractsRoute; |
23 changes: 23 additions & 0 deletions
23
packages/frontend/src/routes/dataContracts/data_contracts.css
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,23 @@ | ||
.data_contracts_list { | ||
color: white; | ||
text-decoration: none; | ||
background-color: #1a491c; | ||
} | ||
|
||
.data_contracts_item { | ||
text-decoration: none; | ||
padding: 5px; | ||
margin-left: 10px; | ||
margin-right: 10px; | ||
background-color: #1a491c; | ||
} | ||
|
||
.data_contracts_item a { | ||
text-decoration: none; | ||
color: white; | ||
} | ||
|
||
.data_contracts_item a:hover { | ||
text-decoration: underline; | ||
color: #76b2d2; | ||
} |
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