mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-01-17 14:18:17 +01:00
Account dropdown changes
This commit is contained in:
parent
c46d962803
commit
d65ecac777
@ -145,7 +145,7 @@ export function CreateRoadmapModal(props: CreateRoadmapModalProps) {
|
|||||||
name="title"
|
name="title"
|
||||||
id="title"
|
id="title"
|
||||||
required
|
required
|
||||||
className="block w-full rounded-md border border-gray-300 px-2.5 py-2 outline-none focus:border-black sm:text-sm"
|
className="block text-black w-full rounded-md border border-gray-300 px-2.5 py-2 outline-none focus:border-black sm:text-sm"
|
||||||
placeholder="Enter Title"
|
placeholder="Enter Title"
|
||||||
value={title}
|
value={title}
|
||||||
onChange={(e) => setTitle(e.target.value)}
|
onChange={(e) => setTitle(e.target.value)}
|
||||||
@ -165,7 +165,7 @@ export function CreateRoadmapModal(props: CreateRoadmapModalProps) {
|
|||||||
name="description"
|
name="description"
|
||||||
required
|
required
|
||||||
className={cn(
|
className={cn(
|
||||||
'block h-24 w-full resize-none rounded-md border border-gray-300 px-2.5 py-2 outline-none focus:border-black sm:text-sm',
|
'block text-black h-24 w-full resize-none rounded-md border border-gray-300 px-2.5 py-2 outline-none focus:border-black sm:text-sm',
|
||||||
isInvalidDescription && 'border-red-300 bg-red-100'
|
isInvalidDescription && 'border-red-300 bg-red-100'
|
||||||
)}
|
)}
|
||||||
placeholder="Enter Description"
|
placeholder="Enter Description"
|
||||||
|
@ -4,12 +4,14 @@ import { isLoggedIn } from '../../lib/jwt';
|
|||||||
import { AccountDropdownList } from './AccountDropdownList';
|
import { AccountDropdownList } from './AccountDropdownList';
|
||||||
import { DropdownTeamList } from './DropdownTeamList';
|
import { DropdownTeamList } from './DropdownTeamList';
|
||||||
import { useOutsideClick } from '../../hooks/use-outside-click';
|
import { useOutsideClick } from '../../hooks/use-outside-click';
|
||||||
|
import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal.tsx';
|
||||||
|
|
||||||
export function AccountDropdown() {
|
export function AccountDropdown() {
|
||||||
const dropdownRef = useRef(null);
|
const dropdownRef = useRef(null);
|
||||||
|
|
||||||
const [showDropdown, setShowDropdown] = useState(false);
|
const [showDropdown, setShowDropdown] = useState(false);
|
||||||
const [isTeamsOpen, setIsTeamsOpen] = useState(false);
|
const [isTeamsOpen, setIsTeamsOpen] = useState(false);
|
||||||
|
const [isCreatingRoadmap, setIsCreatingRoadmap] = useState(false);
|
||||||
|
|
||||||
useOutsideClick(dropdownRef, () => {
|
useOutsideClick(dropdownRef, () => {
|
||||||
setShowDropdown(false);
|
setShowDropdown(false);
|
||||||
@ -22,6 +24,14 @@ export function AccountDropdown() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative z-50 animate-fade-in">
|
<div className="relative z-50 animate-fade-in">
|
||||||
|
{isCreatingRoadmap && (
|
||||||
|
<CreateRoadmapModal
|
||||||
|
onClose={() => {
|
||||||
|
setIsCreatingRoadmap(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="flex h-8 w-40 items-center justify-center gap-1.5 rounded-full bg-gradient-to-r from-purple-500 to-purple-700 px-4 py-2 text-sm font-medium text-white hover:from-purple-500 hover:to-purple-600"
|
className="flex h-8 w-40 items-center justify-center gap-1.5 rounded-full bg-gradient-to-r from-purple-500 to-purple-700 px-4 py-2 text-sm font-medium text-white hover:from-purple-500 hover:to-purple-600"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -43,7 +53,13 @@ export function AccountDropdown() {
|
|||||||
{isTeamsOpen ? (
|
{isTeamsOpen ? (
|
||||||
<DropdownTeamList setIsTeamsOpen={setIsTeamsOpen} />
|
<DropdownTeamList setIsTeamsOpen={setIsTeamsOpen} />
|
||||||
) : (
|
) : (
|
||||||
<AccountDropdownList setIsTeamsOpen={setIsTeamsOpen} />
|
<AccountDropdownList
|
||||||
|
onCreateRoadmap={() => {
|
||||||
|
setIsCreatingRoadmap(true);
|
||||||
|
setShowDropdown(false);
|
||||||
|
}}
|
||||||
|
setIsTeamsOpen={setIsTeamsOpen}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -1,54 +1,76 @@
|
|||||||
import { ChevronRight } from 'lucide-react';
|
import { ChevronRight, LogOut, Map, Plus, User2, Users2 } from 'lucide-react';
|
||||||
import { logout } from './navigation';
|
import { logout } from './navigation';
|
||||||
|
import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal.tsx';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
type AccountDropdownListProps = {
|
type AccountDropdownListProps = {
|
||||||
|
onCreateRoadmap: () => void;
|
||||||
setIsTeamsOpen: (isOpen: boolean) => void;
|
setIsTeamsOpen: (isOpen: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function AccountDropdownList(props: AccountDropdownListProps) {
|
export function AccountDropdownList(props: AccountDropdownListProps) {
|
||||||
const { setIsTeamsOpen } = props;
|
const { setIsTeamsOpen, onCreateRoadmap } = props;
|
||||||
|
const [isCreatingRoadmap, setIsCreatingRoadmap] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul>
|
<ul>
|
||||||
<li className="px-1">
|
<li className="px-1">
|
||||||
<a
|
<a
|
||||||
href="/account"
|
href="/account"
|
||||||
className="block rounded pl-4 pr-2 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
className="group flex items-center gap-2 rounded py-2 pl-3 pr-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
>
|
>
|
||||||
|
<User2 className="h-4 w-4 stroke-[2.5px] text-slate-400 group-hover:text-white" />
|
||||||
Profile
|
Profile
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="px-1">
|
<li className="px-1">
|
||||||
<a
|
<a
|
||||||
href="/account/friends"
|
href="/account/friends"
|
||||||
className="block rounded pl-4 pr-2 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
className="group flex items-center gap-2 rounded py-2 pl-3 pr-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
>
|
>
|
||||||
|
<Users2 className="h-4 w-4 stroke-[2px] text-slate-400 group-hover:text-white" />
|
||||||
Friends
|
Friends
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="px-1">
|
<li className="mt-1 border-t border-t-gray-700/60 px-1 pt-1">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
onCreateRoadmap();
|
||||||
|
}}
|
||||||
|
className="group flex w-full items-center gap-2 rounded py-2 pl-3 pr-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
|
>
|
||||||
|
<Plus className="h-4 w-4 stroke-[2px] text-slate-400 group-hover:text-white" />
|
||||||
|
New Roadmap
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li className="border-b border-b-gray-700/60 px-1 pb-1">
|
||||||
<a
|
<a
|
||||||
href="/account/roadmaps"
|
href="/account/roadmaps"
|
||||||
className="block rounded pl-4 pr-2 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
className="group flex items-center gap-2 rounded py-2 pl-3 pr-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
>
|
>
|
||||||
|
<Map className="h-4 w-4 stroke-[2px] text-slate-400 group-hover:text-white" />
|
||||||
Roadmaps
|
Roadmaps
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="px-1">
|
<li className="px-1 pt-1">
|
||||||
<button
|
<button
|
||||||
className="group flex w-full items-center justify-between rounded pl-4 pr-2 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
className="group flex w-full items-center justify-between rounded py-2 pl-3 pr-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
onClick={() => setIsTeamsOpen(true)}
|
onClick={() => setIsTeamsOpen(true)}
|
||||||
>
|
>
|
||||||
Teams
|
<span className="flex items-center gap-2.5">
|
||||||
|
<Users2 className="h-4 w-4 stroke-[2px] text-slate-400 group-hover:text-white" />
|
||||||
|
Teams
|
||||||
|
</span>
|
||||||
<ChevronRight className="h-4 w-4 shrink-0 stroke-[2.5px] text-slate-400 group-hover:text-white" />
|
<ChevronRight className="h-4 w-4 shrink-0 stroke-[2.5px] text-slate-400 group-hover:text-white" />
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li className="px-1">
|
<li className="px-1">
|
||||||
<button
|
<button
|
||||||
className="block w-full rounded pl-4 pr-2 py-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700"
|
className="group flex gap-2 items-center w-full rounded py-2 pl-3 pr-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={logout}
|
onClick={logout}
|
||||||
>
|
>
|
||||||
|
<LogOut className="h-4 w-4 stroke-[2px] text-slate-400 group-hover:text-white" />
|
||||||
Logout
|
Logout
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user