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

Fix/fix ResourceItem and ResourceCard title issue #225

Merged
merged 3 commits into from
Aug 30, 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useState } from "react";
import React from "react";
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/solid";
import Badge from "@/components/badge/Badge";
import { useAppDispatch } from "@/store/hooks";
Expand All @@ -21,7 +21,6 @@ function ResourceItem({
userAvatarUrl,
}: ResourceItemProps) {
const dispatch = useAppDispatch();
const [widgetHovered, setWidgetHovered] = useState<boolean>(false);

const openViewModal = (event: React.MouseEvent) => {
event.stopPropagation();
Expand All @@ -40,17 +39,15 @@ function ResourceItem({
};

return (
<div
<button
type="button"
aria-label="open resource details"
key={title}
className="mb-4 flex h-[79px] w-full cursor-pointer items-center justify-between rounded-lg bg-base-200 p-4 hover:shadow-md"
className="group mb-4 flex w-full cursor-pointer items-center justify-between gap-x-4 rounded-lg bg-base-200 hover:shadow-md"
onClick={openViewModal}
onMouseEnter={() => setWidgetHovered(true)}
onMouseLeave={() => setWidgetHovered(false)}
>
<div className="flex max-w-[400px] flex-col">
<p className="mb-1 w-[300px] truncate text-base font-semibold max-[1469px]:w-full max-[1200px]:w-56">
{title}
</p>
<div className="flex flex-col p-4">
<p className="mb-1 text-left text-base font-semibold">{title}</p>
<div className="flex">
<p className="mr-2 text-base font-medium">Shared by</p>
<Badge
Expand All @@ -61,12 +58,8 @@ function ResourceItem({
/>
</div>
</div>
<ArrowTopRightOnSquareIcon
className={`mr-3 h-6 w-6 text-base-300 ${
widgetHovered ? "stroke-base-300" : ""
}`}
/>
</div>
<ArrowTopRightOnSquareIcon className="m-7 h-6 w-6 shrink-0 text-base-300 group-hover:stroke-base-300" />
</button>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,34 @@ export default function ResourceCard({
};

return (
<div className="group flex w-full items-center rounded-xl border border-base-200 bg-base-200 p-2 shadow-sm transition-all hover:border-base-100 hover:shadow-md [&>*]:cursor-pointer">
<ArrowTopRightOnSquareIcon
<div className="group relative flex w-full flex-nowrap items-center gap-x-2 rounded-xl border border-base-200 bg-base-200 shadow-sm transition-all hover:border-base-100 hover:shadow-md xl:gap-x-6">
<button
type="button"
aria-label="open resource details"
onClick={openViewModal}
className="ml-2 mr-4 h-8 w-8 stroke-1 transition-all group-hover:stroke-2"
/>
<div
onClick={openViewModal}
className="flex w-full flex-col justify-center overflow-hidden p-2"
className="before:absolute before:left-0 before:top-0 before:h-full before:w-full before:content-['']"
>
<h1 className="w-1/2 truncate text-xl font-bold">{title}</h1>
<div className="mt-2 flex [&>*]:mr-8">
<div className="flex items-center gap-x-2">
<ArrowTopRightOnSquareIcon className="mx-6 h-8 w-8 stroke-1 transition-all group-hover:stroke-2" />
</button>
<div className="my-2 flex w-full flex-col justify-center overflow-hidden p-2">
<h2 className="text-xl font-semibold text-base-300">{title}</h2>
<div className="mt-2 flex">
<div className="flex items-center gap-x-2 border-r border-r-base-100 pr-4 xl:pr-8">
<p>Shared by</p>
<Badge title={user.firstName} avatarUrlImage={user.avatar} />
</div>
<div className="h-5 w-1 border border-y-0 border-l-0 border-r-neutral-content"></div>
<div className="text-neutral-focus">Added {date}</div>
<div className="pl-4 text-neutral-focus xl:pl-8">Added {date}</div>
</div>
</div>
{userId === currentUserId ? (
{userId === currentUserId && (
<IconButton
className="flex h-10 w-10 items-center justify-center rounded-full hover:bg-base-100"
className="z-10 mx-6"
onClick={openDeleteModal}
ariaLabel="delete"
>
<TrashIcon className="h-6 w-6" />
<TrashIcon />
</IconButton>
) : null}
)}
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function IconButton({
<button
type="button"
className={cn(
"flex h-10 w-10 items-center justify-center rounded-full px-2 hover:bg-base-300/25 [&>*]:h-5 [&>*]:w-5 [&>*]:stroke-[1.5px] [&>*]:text-base-300",
"flex h-10 w-10 shrink-0 items-center justify-center rounded-full p-2 hover:bg-base-300/25 [&>*]:h-5 [&>*]:w-5 [&>*]:stroke-[1.5px] [&>*]:text-base-300",
className,
)}
aria-label={ariaLabel}
Expand Down
Loading