11"use client" ;
22import React , { useState } from "react" ;
33import NewCandidates from "./Components/NewCandidates" ;
4+ import PastCandidates from "./Components/PastCandidates" ;
5+ import VerifiedCandidates from "./Components/VerifiedCandidates" ;
46
5- const Candidates = ( ) => {
6- const [ activeTab , setActiveTab ] = useState < TabType > ( "new_candidates" ) ;
7+ const tabs = [
8+ { id : "new_candidates" , label : "New candidates" } ,
9+ { id : "past_candidates" , label : "Past candidates" } ,
10+ { id : "verified_candidates" , label : "Verified candidates" } ,
11+ ] as const ;
712
8- const tabs = [
9- { id : "new_candidates" , label : "New candidates" } ,
10- { id : "past_candidates" , label : "Past candidates" } ,
11- { id : "verified_candidates" , label : "Verified candidates" } ,
12- ] as const ;
13+ type TabType = ( typeof tabs ) [ number ] [ "id" ] ;
1314
14- type TabType = ( typeof tabs ) [ number ] [ "id" ] ;
15+ const CandidatesTabs = ( ) => {
16+ const [ activeTab , setActiveTab ] = useState < TabType > ( "new_candidates" ) ;
1517
1618 const renderComponent = ( ) => {
1719 switch ( activeTab ) {
1820 case "new_candidates" :
1921 return < NewCandidates /> ;
20- // case "past_candidates":
21- // return <Past candidates />;
22- // case "verified_candidates":
23- // return <Verified candidates />;
22+ case "past_candidates" :
23+ return < PastCandidates /> ;
24+ case "verified_candidates" :
25+ return < VerifiedCandidates /> ;
2426 default :
2527 return null ;
2628 }
@@ -33,8 +35,10 @@ const Candidates = () => {
3335 < button
3436 key = { tab . id }
3537 onClick = { ( ) => setActiveTab ( tab . id ) }
36- className = { `px-5 py-3 rounded-md border border-neutral-900 cursor-pointer transition-all ${
37- activeTab === tab . id ? "bg-neutral-800" : "hover:bg-neutral-800"
38+ className = { `px-5 py-3 rounded-md border border-neutral-900 text-white cursor-pointer transition-all ${
39+ activeTab === tab . id
40+ ? "bg-neutral-800"
41+ : "hover:bg-neutral-800"
3842 } `}
3943 >
4044 { tab . label }
@@ -48,4 +52,4 @@ const Candidates = () => {
4852 ) ;
4953} ;
5054
51- export default Candidates ;
55+ export default CandidatesTabs ;
0 commit comments