Skip to content

Commit

Permalink
feat(ui): update board card size on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
DW225 committed Sep 6, 2024
1 parent c07269e commit 604f160
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
26 changes: 4 additions & 22 deletions components/common/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
"use client";

import type { ReactNode} from "react";
import React, { useState, useEffect } from "react";
import type { ReactNode } from "react";
import React from "react";

interface CardProps {
children: ReactNode;
Expand All @@ -18,29 +18,11 @@ const Card: React.FC<CardProps> = ({
className = "",
draggable = false,
}) => {
const [isMobile, setIsMobile] = useState(false);

useEffect(() => {
const checkScreenSize = () => {
setIsMobile(window.innerWidth < 640); // Adjust this breakpoint as needed
};

checkScreenSize();
window.addEventListener("resize", checkScreenSize);

return () => window.removeEventListener("resize", checkScreenSize);
}, []);

const baseClasses =
"rounded-lg shadow-sm transition-all duration-200 overflow-hidden";

const variantClasses = {
board: `bg-white hover:shadow-md
${
isMobile
? "w-full h-24"
: "w-64 h-32 sm:w-56 sm:h-28 md:w-64 md:h-32"
}`,
board: "bg-white hover:shadow-md w-64 h-32 sm:w-56 sm:h-28 md:w-64 md:h-32",
post: "bg-yellow-100 hover:bg-yellow-200 w-full min-h-[80px] my-2",
};

Expand Down
1 change: 0 additions & 1 deletion components/home/CreateBoardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default function CreateBoardForm() {
addBoard(newBoard);
form.reset();

// Here you would typically make an API call to create the board
try {
await createBoard(newBoard, user.id);
} catch (error) {
Expand Down

0 comments on commit 604f160

Please sign in to comment.