Skip to content

Commit

Permalink
Merge pull request code100x#1553 from IkramBagban/feat/tooltip-on-hov…
Browse files Browse the repository at this point in the history
…er-of-video-title

feat: add tooltip on hover of video title (code100x#1550)
  • Loading branch information
siinghd authored Nov 11, 2024
2 parents 5be5b7e + 5d2b866 commit ec94a77
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "^1.0.7",
"@radix-ui/react-tooltip": "^1.1.2",
"@tabler/icons-react": "^3.14.0",
"@types/bcrypt": "^5.0.2",
"@types/jsonwebtoken": "^9.0.5",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function SearchResults({
<div
className={`absolute ${
isMobile ? 'top-full' : 'top-12'
} z-30 max-h-[40vh] w-full overflow-y-auto rounded-lg border-2 bg-background p-2 shadow-lg`}
} z-30 max-h-[40vh] w-full rounded-lg border-2 bg-background p-2 shadow-lg`}
>
{renderSearchResults()}
</div>
Expand Down
23 changes: 19 additions & 4 deletions src/components/search/VideoSearchCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { TSearchedVideos } from '@/app/api/search/route';
import { Play } from 'lucide-react';
import Link from 'next/link';
import React from 'react';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '../ui/tooltip';

interface VideoSearchCardProps {
video: TSearchedVideos;
Expand All @@ -28,13 +34,22 @@ const VideoSearchCard: React.FC<VideoSearchCardProps> = ({
return (
<Link
href={videoUrl}
className="flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 hover:bg-blue-600/10 hover:text-blue-600"
className="group relative flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 hover:bg-blue-600/10 hover:text-blue-600"
onClick={handleClick}
>
<Play className="size-4" />
<span className="w-4/5 truncate font-medium capitalize">
{video.title}
</span>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<span className="w-4/5 truncate font-medium capitalize">
{video.title}
</span>
</TooltipTrigger>
<TooltipContent>
<p>{video.title}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</Link>
);
}
Expand Down

0 comments on commit ec94a77

Please sign in to comment.