forked from GreenPioneer/nx_firebase_template
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #20 from tirzah-dev/assets
finished update assets component
- Loading branch information
Showing
9 changed files
with
99 additions
and
40 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
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,18 @@ | ||
// import { useContext } from 'react'; | ||
// import { AssetContext } from './AssetContext'; | ||
// import { AssetContext } from './Index'; | ||
import { UpdateAssets } from './UpdateAssets'; | ||
|
||
const AssetList = (props: any) => { | ||
// const { assets } = useContext(AssetContext); | ||
|
||
return ( | ||
<ul> | ||
{props.asset.map((asset: any) => ( | ||
<UpdateAssets key={props.asset.id} asset={props.asset.asset} /> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default AssetList; |
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
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
File renamed without changes.
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,30 +1,32 @@ | ||
import { useContext } from 'react'; | ||
import { AssetContext } from './AssetContext'; | ||
|
||
import { useState, useContext } from 'react'; | ||
// import { AssetContext } from './AssetContext'; | ||
import { AssetContext } from '../../app'; | ||
|
||
import './assets.css'; | ||
|
||
export const UpdateAssets = (props: any) => { | ||
const assetContext = useContext(AssetContext); | ||
if (!assetContext) { | ||
throw new Error('AssetContext is not provided'); | ||
} | ||
const { assets } = assetContext; | ||
console.log(assets) | ||
if (!assets) { | ||
return <div>Loading...</div> | ||
} | ||
const { removeAsset, assets } = | ||
useContext(AssetContext); | ||
|
||
|
||
|
||
console.log(assets); | ||
|
||
return ( | ||
<div> | ||
{assets.map(asset => ( | ||
<div key={asset.asset}> | ||
Slide to delete | ||
{assets.map((asset) => ( | ||
<div key={asset.id}> | ||
<p>Asset: {asset.asset}</p> | ||
<p>Amount: {asset.amount}</p> | ||
<div> | ||
<button type="button" className="asset_type_button" onClick={() => removeAsset(asset)}> | ||
Delete | ||
</button> | ||
</div> | ||
<br></br> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'uuid'; |