Skip to content

Commit

Permalink
Style variant list (#114)
Browse files Browse the repository at this point in the history
* Style variant list

* move border
  • Loading branch information
sigridge authored Oct 10, 2023
1 parent ce6a44f commit fc51b48
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,4 @@ $RECYCLE.BIN/
!.vscode/extensions.json

*.[Ll]ocal.json
frontend/.prettierrc
3 changes: 3 additions & 0 deletions frontend/public/icons/chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default function RootLayout({
/>
</Head>
<body>
<AppProviders> {children}</AppProviders>
<AppProviders>
<div className="p-6">{children}</div>
</AppProviders>
</body>
</html>
);
Expand Down
27 changes: 23 additions & 4 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import { VariantList } from "../components/variants";
"use client";
import VariantListElement from "@/components/variantListElement";
import useVibesApi from "@/hooks/useVibesApi";
import { CircularProgress } from "@mui/material";

export default function Page() {
export default function Bemanning() {
const { data, isLoading } = useVibesApi(true);

return <VariantList />
}
if (isLoading) {
return <CircularProgress />;
}

if (data) {
return (
<div>
<h1>Konsulenter</h1>

<p className="body-large-bold pt-16 pb-4">Konsulentliste</p>
{data.map((variant) => (
<VariantListElement key={variant.id} variant={variant} />
))}
</div>
);
}
}
39 changes: 39 additions & 0 deletions frontend/src/components/variantListElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use client";
import { Variant } from "@/types";
import { useState } from "react";

interface VariantListElementProps {
variant: Variant;
}

const VariantListElement = ({ variant }: VariantListElementProps) => {
const [isListElementVisible, setIsListElementVisible] = useState(false);

const toggleListElementVisibility = () => {
setIsListElementVisible(!isListElementVisible);
};

return (
<div
className={`flex flex-col ${
isListElementVisible && "bg-primary_l4"
} border-t-2 border-primary_l4 `}
>
<button
className="flex flex-row gap-6 p-3 hover:bg-primary_default hover:bg-opacity-5"
onClick={toggleListElementVisibility}
>
<div className={`w-6 h-6 m-3 ${isListElementVisible && "rotate-180"}`}>
<img src="icons/chevron-down.svg" alt="chevron-down" className="" />
</div>
<div className="flex flex-col gap-1 justify-center items-start">
<p className="body text-black"> {variant.name}</p>
<p className="detail text-neutral_l1">{variant.email}</p>
</div>
</button>
<div className={`${!isListElementVisible && "hidden"} h-[198px] `}></div>
</div>
);
};

export default VariantListElement;
45 changes: 0 additions & 45 deletions frontend/src/components/variants.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module.exports = {
white: "#FFFFFF",
primary_default: "#423D89",
primary_l3: "#ECECF3",
primary_l4: "#F6F5F9",
secondary_default: "#F076A6",
neutral_l1: "#858585",
},
extend: {},
screens: {
Expand Down

0 comments on commit fc51b48

Please sign in to comment.