From 0dde737842fde3183d13256b44935035e2453491 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Mon, 2 Sep 2024 22:46:06 +0600 Subject: [PATCH] wip: update design --- src/components/Dashboard/DashboardPage.tsx | 2 +- .../Dashboard/PersonalDashboard.tsx | 17 ++++++------ src/components/FeaturedItems/MarkFavorite.tsx | 26 +++++++++++++------ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/components/Dashboard/DashboardPage.tsx b/src/components/Dashboard/DashboardPage.tsx index d1e524cb5..b62e6c2f7 100644 --- a/src/components/Dashboard/DashboardPage.tsx +++ b/src/components/Dashboard/DashboardPage.tsx @@ -97,7 +97,7 @@ export function DashboardPage(props: DashboardPageProps) { label="+ Create Team" isActive={false} href="/team/new" - className="border-black bg-black text-white" + className="border border-dashed text-gray-600 hover:border-gray-600 hover:text-black" /> )} diff --git a/src/components/Dashboard/PersonalDashboard.tsx b/src/components/Dashboard/PersonalDashboard.tsx index ce59306a2..f3d0ad556 100644 --- a/src/components/Dashboard/PersonalDashboard.tsx +++ b/src/components/Dashboard/PersonalDashboard.tsx @@ -151,11 +151,11 @@ export function PersonalDashboard(props: PersonalDashboardProps) { return (
{isLoading && ( -
+
)} {!isLoading && ( -
-
+
+
-
+ diff --git a/src/components/FeaturedItems/MarkFavorite.tsx b/src/components/FeaturedItems/MarkFavorite.tsx index 3d6191c31..05bc80aa9 100644 --- a/src/components/FeaturedItems/MarkFavorite.tsx +++ b/src/components/FeaturedItems/MarkFavorite.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import type { MouseEvent } from "react"; +import type { MouseEvent } from 'react'; import { httpPatch } from '../../lib/http'; import type { ResourceType } from '../../lib/resource-progress'; import { isLoggedIn } from '../../lib/jwt'; @@ -7,6 +7,7 @@ import { showLoginPopup } from '../../lib/popup'; import { FavoriteIcon } from './FavoriteIcon'; import { Spinner } from '../ReactIcons/Spinner'; import { useToast } from '../../hooks/use-toast'; +import { cn } from '../../lib/classname'; type MarkFavoriteType = { resourceType: ResourceType; @@ -27,7 +28,9 @@ export function MarkFavorite({ const toast = useToast(); const [isLoading, setIsLoading] = useState(false); const [isFavorite, setIsFavorite] = useState( - isAuthenticated ? (favorite ?? localStorage.getItem(localStorageKey) === '1') : false + isAuthenticated + ? (favorite ?? localStorage.getItem(localStorageKey) === '1') + : false, ); async function toggleFavoriteHandler(e: MouseEvent) { @@ -48,7 +51,7 @@ export function MarkFavorite({ { resourceType, resourceId, - } + }, ); if (error) { @@ -68,7 +71,7 @@ export function MarkFavorite({ resourceType, isFavorite: !isFavorite, }, - }) + }), ); window.dispatchEvent(new CustomEvent('refresh-favorites', {})); @@ -99,11 +102,18 @@ export function MarkFavorite({ aria-label={isFavorite ? 'Remove from favorites' : 'Add to favorites'} onClick={toggleFavoriteHandler} tabIndex={-1} - className={`${isFavorite ? '' : 'opacity-30 hover:opacity-100'} ${ - className || 'absolute right-1.5 top-1.5 z-30 focus:outline-0' - }`} + className={cn( + 'absolute right-1.5 top-1.5 z-30 focus:outline-0', + isFavorite ? '' : 'opacity-30 hover:opacity-100', + className, + )} + data-is-favorite={isFavorite} > - {isLoading ? : } + {isLoading ? ( + + ) : ( + + )} ); }