Skip to content

Commit

Permalink
add margin top when top nav is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonath-z committed Jun 27, 2022
1 parent d535cff commit 8c2cd22
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 5 additions & 3 deletions components/CategoryPage/index.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import React, { useState } from "react";
import Category from "../modules/Category";
import PageCard from "../modules/__modules__/Card/PageCard";

const CategoryPage = () => {
const [isTopNav, setIsTopNav] = useState(false);

return (
<PageCard>
<Category />
<PageCard setIsTopNav={setIsTopNav}>
<Category isTopNav={isTopNav} />
</PageCard>
);
};
Expand Down
13 changes: 11 additions & 2 deletions components/modules/Category/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from "react";
import { VPen, VTrash } from "../__modules/Vectors";
import Link from "next/link";
import PropTypes from "prop-types";

const Category = () => {
const Category = ({ isTopNav }) => {
return (
<div className="my-24 bg-white flex flex-col mr-5 border shadow-lg rounded-lg overflow-x-auto">
<div
className={`my-24 bg-white flex flex-col mr-5 border shadow-lg rounded-lg overflow-x-auto ${
isTopNav && "my-40"
} transition-all`}
>
<div className="flex justify-between items-center px-5 py-5 border-b border-gray-200">
<h3 className="font-bold text-2xl">Category Lists</h3>
<Link href="/admin/addcategory">
Expand Down Expand Up @@ -76,4 +81,8 @@ const Category = () => {
);
};

Category.propsTypes = {
isTopNav: PropTypes.bool.isRequired,
};

export default Category;

0 comments on commit 8c2cd22

Please sign in to comment.