-
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.
- Loading branch information
Showing
13 changed files
with
282 additions
and
14 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,33 @@ | ||
"use client"; | ||
|
||
import { ChevronDownIcon } from "@heroicons/react/24/solid"; | ||
import type { Information } from "@lib/api/member/types"; | ||
import { useState } from "react"; | ||
|
||
interface Props { | ||
information: Information; | ||
} | ||
|
||
export default function BiographyEntry({ information }: Props) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
function toggleEntry() { | ||
setIsOpen((prevState) => !prevState); | ||
} | ||
|
||
return ( | ||
<button | ||
className="group w-full border-t-2 border-slate-300 text-left dark:border-slate-600" | ||
onClick={toggleEntry} | ||
aria-expanded={isOpen} | ||
> | ||
<div className="flex items-center justify-between p-4"> | ||
{information.code} | ||
<ChevronDownIcon className="h-4 w-4 transition-transform group-aria-[expanded=true]:rotate-180" /> | ||
</div> | ||
<div className="px-4 pb-6 pt-2 group-aria-[expanded=false]:hidden"> | ||
{information.content} | ||
</div> | ||
</button> | ||
); | ||
} |
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,27 @@ | ||
import { Card } from "@components/card"; | ||
import type { Information } from "@lib/api/member/types"; | ||
import BiographyEntry from "./biography-entry"; | ||
|
||
interface Props { | ||
memberInformation: Information[]; | ||
} | ||
|
||
export default function Biography({ memberInformation }: Props) { | ||
if (memberInformation.length === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Card className="p-0"> | ||
<h4 className="p-4 text-xl sm:text-2xl">Biografi</h4> | ||
<div> | ||
{memberInformation.map((info) => ( | ||
<BiographyEntry | ||
key={`${info.type}:${info.code}`} | ||
information={info} | ||
/> | ||
))} | ||
</div> | ||
</Card> | ||
); | ||
} |
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,24 @@ | ||
"use client"; | ||
import type { MemberDocuments } from "@lib/api/member/types"; | ||
import { useState } from "react"; | ||
|
||
function Document() { | ||
return <div>hej</div>; | ||
} | ||
|
||
interface Props { | ||
memberId: string; | ||
initialDocuments: MemberDocuments; | ||
} | ||
|
||
export default function Documents({ initialDocuments, memberId }: Props) { | ||
const [documents, setDocuments] = useState(initialDocuments.documents); | ||
|
||
return ( | ||
<> | ||
{documents.map((document) => ( | ||
<div key={document.id}>{document.altTitle}</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
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,54 @@ | ||
"use client"; | ||
|
||
import { Card } from "@components/card"; | ||
import type { MemberDocuments } from "@lib/api/member/types"; | ||
import { useState } from "react"; | ||
import Documents from "./documents"; | ||
|
||
enum Tab { | ||
Document = "document-tab", | ||
Twitter = "twitter-tab", | ||
} | ||
|
||
interface Props { | ||
memberId: string; | ||
initialDocuments: MemberDocuments; | ||
} | ||
|
||
export default function Tabs({ memberId, initialDocuments }: Props) { | ||
const [activeTab, setActiveTab] = useState(Tab.Document); | ||
|
||
function setTab(event: React.MouseEvent) { | ||
if ("id" in event.target) { | ||
setActiveTab(event.target.id as Tab); | ||
} | ||
} | ||
|
||
return ( | ||
<Card className="p-0"> | ||
<div className="flex" role="tablist"> | ||
<button | ||
role="tab" | ||
aria-selected={activeTab === Tab.Document} | ||
id={Tab.Document} | ||
onClick={setTab} | ||
className="border-primary flex-1 py-4 aria-selected:border-b-2" | ||
> | ||
Dokument | ||
</button> | ||
<button | ||
role="tab" | ||
aria-selected={activeTab === Tab.Twitter} | ||
id={Tab.Twitter} | ||
onClick={setTab} | ||
className="border-primary flex-1 py-4 aria-selected:border-b-2" | ||
> | ||
Twitter-flöde | ||
</button> | ||
</div> | ||
{activeTab === Tab.Document && ( | ||
<Documents initialDocuments={initialDocuments} memberId={memberId} /> | ||
)} | ||
</Card> | ||
); | ||
} |
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
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,125 @@ | ||
export enum Committee { | ||
AU = "AU", | ||
CU = "CU", | ||
FiU = "FiU", | ||
FöU = "FöU", | ||
JuU = "JuU", | ||
KU = "KU", | ||
KrU = "KrU", | ||
MJU = "MJU", | ||
NU = "NU", | ||
SkU = "SkU", | ||
SfU = "SfU", | ||
SoU = "SoU", | ||
TU = "TU", | ||
UbU = "UbU", | ||
UU = "UU", | ||
UFöU = "UFöU", | ||
} | ||
|
||
export const committeeColors: Record<Committee, string> = { | ||
[Committee.AU]: "#3498db", | ||
[Committee.CU]: "#f39c12", | ||
[Committee.FiU]: "#1abc9c", | ||
[Committee.FöU]: "#2980b9", | ||
[Committee.JuU]: "#34495e", | ||
[Committee.KU]: "#d35400", | ||
[Committee.KrU]: "#8e44ad", | ||
[Committee.MJU]: "#27ae60", | ||
[Committee.NU]: "#f1c40f", | ||
[Committee.SkU]: "#575fcf", | ||
[Committee.SfU]: "#ef5777", | ||
[Committee.SoU]: "#ff5e57", | ||
[Committee.TU]: "#3c40c6", | ||
[Committee.UbU]: "#808e9b", | ||
[Committee.UU]: "#f53b57", | ||
[Committee.UFöU]: "#ffa801", | ||
}; | ||
|
||
export interface CommitteeInformation { | ||
name: string; | ||
desc: string; | ||
} | ||
|
||
export const committeeInfo: Record<Committee, CommitteeInformation> = { | ||
[Committee.AU]: { | ||
name: "Arbetsmarknadsutskottet", | ||
desc: "Arbetsmarknad och arbetsliv", | ||
color: "#3498db", | ||
}, | ||
[Committee.CU]: { | ||
name: "Civilutskottet", | ||
desc: "Bostad- och konsumentpolitik", | ||
color: "#f39c12", | ||
}, | ||
[Committee.FiU]: { | ||
name: "Finansutskottet", | ||
desc: "Ekonomi och finans", | ||
color: "#1abc9c", | ||
}, | ||
[Committee.FöU]: { | ||
name: "Försvarsutskottet", | ||
desc: "Försvar och militär", | ||
color: "#2980b9", | ||
}, | ||
[Committee.JuU]: { | ||
name: "Justitieutskottet", | ||
desc: "Rättsväsende och kriminalitet", | ||
color: "#34495e", | ||
}, | ||
[Committee.KU]: { | ||
name: "Konstitutionsutskottet", | ||
desc: "Riksdagen", | ||
color: "#d35400", | ||
}, | ||
[Committee.KrU]: { | ||
name: "Kulturutskottet", | ||
desc: "Kultur och folkbildning", | ||
color: "#8e44ad", | ||
}, | ||
[Committee.MJU]: { | ||
name: "Miljö- och jordbruksutskottet", | ||
desc: "Miljö och jordbruk", | ||
color: "#27ae60", | ||
}, | ||
[Committee.NU]: { | ||
name: "Näringsutskottet", | ||
desc: "Näringsliv och energi", | ||
color: "#f1c40f", | ||
}, | ||
[Committee.SkU]: { | ||
name: "Skatteutskottet", | ||
desc: "Skatter", | ||
color: "#575fcf", | ||
}, | ||
[Committee.SfU]: { | ||
name: "Socialförsäkringsutskottet", | ||
desc: "Socialförsäkringar", | ||
color: "#ef5777", | ||
}, | ||
[Committee.SoU]: { | ||
name: "Socialutskottet", | ||
desc: "Vård och omsorg", | ||
color: "#ff5e57", | ||
}, | ||
[Committee.TU]: { | ||
name: "Trafikutskottet", | ||
desc: "Trafik och transport", | ||
color: "#3c40c6", | ||
}, | ||
[Committee.UbU]: { | ||
name: "Utbildningsutskottet", | ||
desc: "Utbildning", | ||
color: "#808e9b", | ||
}, | ||
[Committee.UU]: { | ||
name: "Utrikesutskottet", | ||
desc: "Utrikes", | ||
color: "#f53b57", | ||
}, | ||
[Committee.UFöU]: { | ||
name: "Sammansatta utrikes- och försvarsutskottet", | ||
desc: "Utrikesförsvar", | ||
color: "#ffa801", | ||
}, | ||
}; |
Empty file.
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