|
1 | 1 | import React, { useState, useEffect } from 'react'; |
2 | 2 | import { Link } from 'react-router-dom'; |
3 | | -import { ArrowLeftIcon } from '@phosphor-icons/react'; |
| 3 | +import { ArrowLeftIcon, CaretDown, CaretUp } from '@phosphor-icons/react'; |
4 | 4 | import LogCard from '../components/LogCard'; |
5 | 5 | import ColorLegends from '../components/ColorLegends'; |
6 | 6 | import usePageTitle from "../utils/usePageTitle"; |
7 | 7 |
|
8 | 8 | const LogsPage = () => { |
9 | 9 | usePageTitle('Logs <?>'); |
10 | 10 | const [logs, setLogs] = useState([]); |
| 11 | + const [showLegends, setShowLegends] = useState(false); |
11 | 12 | const [loading, setLoading] = useState(true); |
12 | 13 |
|
13 | 14 | useEffect(() => { |
@@ -58,12 +59,26 @@ const LogsPage = () => { |
58 | 59 | <h1 className="text-4xl font-bold tracking-tight text-primary-400 sm:text-6xl mb-4 flex items-center"> |
59 | 60 | Logs |
60 | 61 | </h1> |
61 | | - <hr className="border-gray-700 mb-8" /> |
62 | | - <div className="mb-8 mx-auto p-6 border border-gray-700 rounded-lg shadow-lg text-center bg-gray-900"> |
| 62 | + <div |
| 63 | + className="relative flex justify-center items-center w-full cursor-pointer" |
| 64 | + onClick={() => setShowLegends(!showLegends)} |
| 65 | + > |
| 66 | + <hr className="border-gray-700 w-full absolute" /> |
| 67 | + <div className="relative bg-gray-900 px-4 z-10"> |
| 68 | + {showLegends ? ( |
| 69 | + <CaretUp size={32} className="text-primary-400" /> |
| 70 | + ) : ( |
| 71 | + <CaretDown size={32} className="text-primary-400" /> |
| 72 | + )} |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + {showLegends && ( |
| 76 | + <div className="mx-auto p-6 border border-gray-700 rounded-lg shadow-lg text-center bg-gray-900 mt-0 mb-8"> |
63 | 77 | <h2 className="text-2xl font-semibold tracking-tight text-white">Legends</h2> |
64 | 78 | <ColorLegends /> |
65 | | - </div> |
66 | | - <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8"> |
| 79 | + </div> |
| 80 | + )} |
| 81 | + <div className={`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 ${!showLegends ? 'mt-8' : ''}`}> |
67 | 82 | {logs.map((log, index) => ( |
68 | 83 | <LogCard key={index} log={log} index={index} totalLogs={logs.length} /> |
69 | 84 | ))} |
|
0 commit comments