Skip to content

Commit

Permalink
client: modify nav links, search page ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham-Lal authored Aug 11, 2024
2 parents c34942d + 033d49e commit 1c489ec
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 238 deletions.
2 changes: 1 addition & 1 deletion client/src/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ children }) => {
return <Navigate to='/auth' replace />
}

return <>{children}</>
return children
}
127 changes: 0 additions & 127 deletions client/src/components/card/claim-username.css

This file was deleted.

90 changes: 0 additions & 90 deletions client/src/components/card/claim-username.tsx

This file was deleted.

1 change: 1 addition & 0 deletions client/src/components/card/closed-debate-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
}

#closed-card .left h2 {
width: fit-content;
font-size: 22px;
font-weight: 600;
overflow: hidden;
Expand Down
1 change: 1 addition & 0 deletions client/src/components/card/open-debate-card.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#open-card h2 {
width: fit-content;
font-size: 22px;
font-weight: 600;
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/sidebar/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './explore.css'
import { useRef, useState } from 'react'
import { useNavigate, Link } from 'react-router-dom'
import { IoSearch } from 'react-icons/io5'
import { categoriesData } from '../../data/categories-data'
import { categoriesData } from '../../data/categories'

interface ExploreProps {
term?: string
Expand Down
13 changes: 12 additions & 1 deletion client/src/components/sidebar/left-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
}

#left-sidebar.open {
Expand Down Expand Up @@ -44,6 +43,10 @@
overflow-y: auto;
}

#left-sidebar ul li:nth-child(3) {
display: none;
}

#left-sidebar .links__wrapper {
width: fit-content;
display: flex;
Expand Down Expand Up @@ -198,6 +201,14 @@
justify-content: center;
}

#left-sidebar ul li:nth-child(3) {
display: flex;
}

#left-sidebar ul li:last-child {
display: none;
}

#left-sidebar .links__wrapper p {
display: none;
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/sidebar/left-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, Link, useNavigate } from 'react-router-dom'
import { toast } from 'sonner'
import { AuthStatus, AuthTab, useAuthStore } from '../../store/useAuthStore'
import { useNavStore } from '../../store/useNavStore'
import { leftSidebarLinks } from '../../data/left-sidebar-links'
import { navLinks } from '../../data/nav-links'
import Profile from './profile'
import { GoPerson } from 'react-icons/go'
import LoadingSkeleton from '../loading/skeleton'
Expand Down Expand Up @@ -37,7 +37,7 @@ const LeftSidebar: React.FC<SidebarProps> = ({ isVisible }) => {
<img src='/logo.png' alt='' />
</Link>
<ul>
{leftSidebarLinks.map(item => (
{navLinks.map(item => (
<li key={item.id} title={item.name} className={location.pathname === item.href ? 'active' : ''}>
<div onClick={() => handleLinkClick(item.href, item.name)} className='links__wrapper'>
<item.icon />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { RiHome2Fill, RiFireFill } from 'react-icons/ri'
import { FaFeather } from 'react-icons/fa6'
import { IoSearch } from 'react-icons/io5'
import { IoMdCreate } from 'react-icons/io'
// import { PiBellSimpleFill } from 'react-icons/pi'

export const leftSidebarLinks = [
export const navLinks = [
{
id: 1,
name: 'Home',
Expand Down Expand Up @@ -35,10 +34,10 @@ export const leftSidebarLinks = [
href: '/open-topics',
icon: FaFeather
},
// {
// id: 6,
// name: 'Notifications',
// href: '/notifications',
// icon: PiBellSimpleFill
// }
{
id: 6,
name: 'Create Debate',
href: '/create',
icon: IoMdCreate
}
]
9 changes: 7 additions & 2 deletions client/src/pages/search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import './style.css'
import { useState, useEffect } from 'react'
import { useLocation, useNavigate } from 'react-router-dom'
import { useNavStore } from '../../store/useNavStore'
import Explore from '../../components/sidebar/explore'
import { IoMdClose } from 'react-icons/io'
import { PiArrowBendUpRightBold } from 'react-icons/pi'
Expand All @@ -9,6 +10,8 @@ export default function SearchPage() {
const location = useLocation()
const navigate = useNavigate()

const { sidebar } = useNavStore()

const [searchTerm, setSearchTerm] = useState('')

useEffect(() => {
Expand All @@ -25,7 +28,9 @@ export default function SearchPage() {

return (
<div id='search'>
<Explore term={searchTerm} />
<div className={`explore__container ${sidebar ? 'visible' : 'hidden'}`}>
<Explore term={searchTerm} />
</div>

{searchTerm ? (
<>
Expand All @@ -40,7 +45,7 @@ export default function SearchPage() {
<p>No debates found</p>
</>
) : (
<div className='search-here'>
<div className={`search-here ${sidebar ? 'hidden' : ''}`}>
<PiArrowBendUpRightBold size={50} />
<h2>Search here</h2>
</div>
Expand Down
Loading

0 comments on commit 1c489ec

Please sign in to comment.