Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement antd responsive layout #146

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/DeleteArticleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function DeleteProductButton({ articleId }: { articleId: string }) {
title="Supprimer cet article ? "
description="Toutes les données le concernant seront perdues."
okText="Oui"
className="bg-red-500 text-white hover:bg-red-600 focus:outline-none"
cancelText="Non"
onConfirm={() =>
deleteArticle({
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/DeleteProductButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function DeleteProductButton({ productId }: { productId: string }) {
})
}
>
<Button>Supprimer</Button>
<Button className="bg-red-500 text-white hover:bg-red-600 focus:outline-none">
Supprimer
</Button>
</Popconfirm>
);
}
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/EditProduct/EditProductRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ function EditProductRow({ product }: EditProductRowProps) {

return (
<>
<Button onClick={() => setIsModalOpen(true)}>Modifier</Button>
<Button
onClick={() => setIsModalOpen(true)}
className="bg-blue-500 text-white hover:bg-blue-600 focus:outline-none"
>
Modifier
</Button>
<EditProductModal
isModalOpen={isModalOpen}
setIsModalOpen={setIsModalOpen}
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Link } from "react-router-dom";
import { Layout } from "antd"


function Footer() {
return (
<div className="fixed bottom-0 flex justify-center w-full bg-lightBlue gap-4 p-4 mt-4 text-white text-xs">
<Layout.Footer className="fixed bottom-0 flex justify-center w-full bg-lightBlue gap-4 p-4 mt-4 text-white text-xs">
<Link to="#">Lien 1</Link>
<Link to="#">Lien 2</Link>
<Link to="#">Lien 3</Link>
<Link to="#">Lien 4</Link>
</div>
</Layout.Footer>
);
}

Expand Down
42 changes: 22 additions & 20 deletions frontend/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Outlet } from "react-router-dom";
import Navbar from "./Navbar";
import Footer from "./Footer";
import { useWhoAmIQuery } from "../generated/graphql-types";
import { Layout as AntLayout } from "antd"
import { Content } from "antd/es/layout/layout";

export const UserContext = createContext({
isLoggedIn: false,
Expand All @@ -26,26 +28,26 @@ function Layout() {

if (data) {
return (
<UserContext.Provider
value={{
isLoggedIn: data.whoAmI.isLoggedIn,
email: data.whoAmI.email ?? "",
role: data.whoAmI.role ?? "",
firstname: data.whoAmI.firstname ?? "",
lastname: data.whoAmI.lastname ?? "",
refetch: refetch,
}}
>
<div>
<Navbar />
<main>
<Outlet />
</main>
<div className="flex justify-center">
<Footer />
</div>
</div>
</UserContext.Provider>
<UserContext.Provider
value={{
isLoggedIn: data.whoAmI.isLoggedIn,
email: data.whoAmI.email ?? "",
role: data.whoAmI.role ?? "",
firstname: data.whoAmI.firstname ?? "",
lastname: data.whoAmI.lastname ?? "",
refetch: refetch,
}}
>
<AntLayout>
<Navbar />
<Content>
<Outlet />
</Content>
<div className="flex justify-center">
<Footer />
</div>
</AntLayout>
</UserContext.Provider>
);
}

Expand Down
Loading
Loading