Skip to content

Commit

Permalink
Merge branch 'feature/pairHeader' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandineBI authored Oct 24, 2023
2 parents a24a27a + f8068a3 commit c03db1d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/PairHeader.tsx
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">&#65088;</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;
10 changes: 10 additions & 0 deletions src/interfaces/Pair.tsx
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;
11 changes: 11 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import PairHeader from "~/components/PairHeader";
import type Pair from "~/interfaces/Pair";


export default function Home() {
// const hello = api.post.hello.useQuery({ text: "from tRPC" });
const pair: Pair = {
name: "XDCPerp/USDC",
price: 0,
change: 0,
high: 0,
low: 0
};

return (
<main className="container mx-auto mb-8 mt-4 grid w-full grow grid-cols-4 gap-4">
Expand Down

0 comments on commit c03db1d

Please sign in to comment.