Skip to content

Commit

Permalink
Merge pull request #146 from WildCodeSchool/bugfix/139/responsive-web…
Browse files Browse the repository at this point in the history
…site

implement antd responsive layout
  • Loading branch information
AntoniSDev authored Dec 13, 2024
2 parents 0cbbed1 + c0b5d70 commit 9e9a31b
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 106 deletions.
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

0 comments on commit 9e9a31b

Please sign in to comment.