Skip to content

Commit

Permalink
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
Browse files Browse the repository at this point in the history
…eline-Sidekick-App into categories-page
  • Loading branch information
LillianHo5 committed May 27, 2024
2 parents 8896691 + ef63f13 commit 1c1516a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions admin-portal-frontend/src/app/components/CategoryContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
"use client";

import React, { useState } from "react";
import { Category } from "./categoryRoutes";
import DeleteConfirmationPopup from "./DeletePopup";

import TrashIcon from "../icons/trash.svg";
import EditIcon from "../icons/edit.svg";

import DeleteConfirmationPopup from "./DeletePopup";

import { Category } from "./categoryRoutes";

type IconProps = {
'content-type': string,
src: string
}

type CategoryItemProps = {
id: string;
title: string;
Expand All @@ -23,7 +31,7 @@ const CategoryItem: React.FC<CategoryItemProps> = ({ id, title, pages, onDeleteC
setPopupVisible(true);
};

const handleConfirmDelete = async () => {
const handleConfirmDelete = () => {
try {
onDeleteCategory(id);
setPopupVisible(false);
Expand Down Expand Up @@ -63,11 +71,11 @@ const CategoryItem: React.FC<CategoryItemProps> = ({ id, title, pages, onDeleteC
setAllowEdits(!allowEdits);
}}
>
<img src={EditIcon.src} alt="Edit" className="w-4 h-4" />
<img src={( EditIcon as IconProps ).src} alt="Edit" className="w-4 h-4" />
</button>
<button className="bg-[#E5EFF5] p-2 rounded-full border border-black">
<img
src={TrashIcon.src}
src={( TrashIcon as IconProps ).src}
alt="Delete"
className="w-4 h-4"
onClick={() => {
Expand Down Expand Up @@ -105,6 +113,7 @@ export const CategoryContainer: React.FC<{
.map((category: Category) => {
return (
<CategoryItem
key={category._id}
id={category._id}
title={category.title}
pages={category.items.length}
Expand Down

0 comments on commit 1c1516a

Please sign in to comment.