forked from XinFinOrg/DC-EBC-Hackathon
-
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.
Merge branch 'feature/pairHeader' into main
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 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,46 @@ | ||
import React, { useState } from "react"; | ||
import type Pair from "~/interfaces/Pair"; | ||
|
||
|
||
interface PairHeaderProps { | ||
pair:Pair | ||
} | ||
|
||
const PairHeader = (props:PairHeaderProps) => { | ||
const [showPairs, setShowPairs] = useState(false); | ||
|
||
function togglePairs() { | ||
setShowPairs(prevShowPairs => !prevShowPairs); | ||
console.log(showPairs); | ||
} | ||
|
||
return ( | ||
<div className="container mx-auto p-5 w-full flex space-x-4 text-white"> | ||
<div className="static"> | ||
<button className="font-bold shadow hover:shadow-xl static flex" | ||
onClick={togglePairs}> | ||
<div className="h-full text-xl">{props.pair.name}</div> | ||
<div className="h-full align-bottom mt-2 mb-0 pl-3">﹀</div> | ||
</button> | ||
|
||
<div className={"absolute bottom-0 left-0 " + showPairs?"":"collapse"}> | ||
This is the list of pairs. | ||
</div> | ||
</div> | ||
<div> | ||
Price | ||
</div> | ||
<div> | ||
24h Change | ||
</div> | ||
<div> | ||
24h High | ||
</div> | ||
<div> | ||
24h Low | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PairHeader; |
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,10 @@ | ||
interface Pair { | ||
name: string, | ||
price: number, | ||
change: number, | ||
high: number, | ||
low: number | ||
}; | ||
|
||
|
||
export default Pair; |
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