-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ui): Enhance components with responsive design and improved …
…styling - Refactored `Communities`, `Posts` & `PostVoteClient` components - Refined PostFeed and EditorOutput styling with better color and layout - Updated button and navigation components with more consistent design language - Added Paragraph module in `EditorOutput`
- Loading branch information
1 parent
e4b91a8
commit b069afc
Showing
10 changed files
with
145 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,105 @@ | ||
"use client" | ||
"use client"; | ||
|
||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; | ||
import { Button, buttonVariants } from "@/components/ui/button"; | ||
import { ChevronRight, Plus } from "lucide-react"; | ||
import { Button } from "@/components/ui/button"; | ||
import { ChevronRight, Menu, Plus } from "lucide-react"; | ||
import Link from "next/link"; | ||
import { useState } from "react"; | ||
|
||
type CommunityType = { | ||
name: string; | ||
members: string; | ||
avatar: string; | ||
link: string; | ||
}; | ||
|
||
export function Communities() { | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
|
||
return ( | ||
// <div className="bg-card rounded-lg border border-card-border p-4 space-y-4 "> | ||
<div className={`bg-card rounded-lg border border-card-border p-4 space-y-4 ${isMenuOpen ? "block" : "hidden md:block"}`}> | ||
<div className="flex items-center justify-between"> | ||
<h2 className="text-lg font-bold">Communities</h2> | ||
<Button variant="ghost" size="icon"> | ||
<Link href='/sub/create' className={buttonVariants({variant: "ghost"})}> | ||
<Plus className="w-5 h-5 hover:w-6 hover:h-6" /> | ||
</Link> | ||
<span className="sr-only">Create Community</span> | ||
</Button> | ||
</div> | ||
<div className="grid gap-2"> | ||
<CommunityLink name="Study Group" members="1.2k" avatar="SG" /> | ||
<CommunityLink name="Programming" members="5.4k" avatar="PG" /> | ||
<CommunityLink name="Design" members="2.8k" avatar="DS" /> | ||
<CommunityLink name="Universities" members="3.6k" avatar="Uni" /> | ||
<div className="space-y-4"> | ||
<Button | ||
variant="ghost" | ||
size="icon" | ||
className="md:hidden" | ||
onClick={() => setIsMenuOpen(!isMenuOpen)} | ||
aria-label="Toggle communities menu" | ||
> | ||
<Menu className="h-5 w-5" /> | ||
</Button> | ||
|
||
<div | ||
className={`bg-card rounded-lg border shadow-sm transition-all duration-200 ${ | ||
isMenuOpen ? "block" : "hidden md:block" | ||
}`} | ||
> | ||
<div className="p-4 space-y-4"> | ||
<div className="flex items-center justify-between"> | ||
<h2 className="text-lg font-semibold">Communities</h2> | ||
<Link href="/sub/create"> | ||
<Button | ||
variant="ghost" | ||
size="icon" | ||
className="group transition-colors" | ||
> | ||
<Plus className="h-5 w-5 transition-transform group-hover:scale-110" /> | ||
<span className="sr-only">Create Community</span> | ||
</Button> | ||
</Link> | ||
</div> | ||
|
||
<div className="space-y-2"> | ||
<CommunityLink | ||
name="Study Group" | ||
members="1.2k" | ||
avatar="SG" | ||
link="/sub/study-group" | ||
/> | ||
<CommunityLink | ||
name="Programming" | ||
members="5.4k" | ||
avatar="PG" | ||
link="/sub/programming" | ||
/> | ||
<CommunityLink | ||
name="Design" | ||
members="2.8k" | ||
avatar="DS" | ||
link="/sub/design" | ||
/> | ||
<CommunityLink | ||
name="Universities" | ||
members="3.6k" | ||
avatar="Uni" | ||
link="/sub/universities" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function CommunityLink({ name, members, avatar }: CommunityType) { | ||
function CommunityLink({ name, members, avatar, link }: CommunityType) { | ||
return ( | ||
<Link | ||
href="#" | ||
className="flex items-center gap-3 bg-muted/20 rounded-md px-3 py-2 hover:bg-muted/30" | ||
href={link} | ||
className="group flex items-center gap-3 p-2 rounded-md hover:bg-accent/50 transition-colors" | ||
prefetch={false} | ||
> | ||
<div className="w-10 h-10 rounded-full border overflow-hidden"> | ||
<Avatar> | ||
<AvatarImage | ||
src="/placeholder-user.jpg" | ||
alt={name} | ||
className="w-full h-full object-cover" | ||
/> | ||
<Avatar className="h-10 w-10 border shadow-sm"> | ||
<AvatarImage src="/placeholder-user.jpg" alt={name} /> | ||
<AvatarFallback className="bg-muted text-muted-foreground"> | ||
{avatar} | ||
</AvatarFallback> | ||
</Avatar> | ||
|
||
<AvatarFallback className="w-full h-full flex items-center justify-center"> | ||
{avatar} | ||
</AvatarFallback> | ||
</Avatar> | ||
</div> | ||
<div className="flex-1"> | ||
<div className="font-medium">{name}</div> | ||
<div className="flex-1 min-w-0"> | ||
<div className="font-medium text-sm truncate">{name}</div> | ||
<div className="text-xs text-muted-foreground">{members} members</div> | ||
</div> | ||
<Button variant="ghost" size="icon"> | ||
<ChevronRight className="w-5 h-5" /> | ||
<span className="sr-only">View Community</span> | ||
</Button> | ||
|
||
<ChevronRight className="h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5" /> | ||
</Link> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.