-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactor/#472
- Loading branch information
Showing
10 changed files
with
179 additions
and
312 deletions.
There are no files selected for viewing
Binary file added
BIN
+198 KB
apps/web/public/images/banner/posts/leetcode-november-2024-daily-challenge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 +1,30 @@ | ||
import React from 'react'; | ||
import { projectTags } from '@/config/portfolio'; | ||
import { handleItemClick } from '@/lib/utils/filter-utils'; | ||
import Link from 'next/link'; | ||
|
||
interface FilterListProps { | ||
selectedValue: string; | ||
setSelectedValue: React.Dispatch<React.SetStateAction<string>>; | ||
selectedTag: string; | ||
blogTags: string[]; | ||
} | ||
|
||
const FilterList: React.FC<FilterListProps> = ({ selectedValue, setSelectedValue }) => ( | ||
<ul className="filter-list"> | ||
{projectTags.map((tag) => ( | ||
<li className="filter-item" key={tag}> | ||
<button | ||
className={`filter-btn ${selectedValue === tag ? 'active' : ''}`} | ||
onClick={() => handleItemClick(tag, setSelectedValue)} | ||
> | ||
{tag} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
const FilterList: React.FC<FilterListProps> = ({ | ||
selectedTag, | ||
blogTags | ||
}) => { | ||
|
||
return ( | ||
<ul className="filter-list"> | ||
{blogTags.map((tag, index) => ( | ||
<li className="filter-item" key={index}> | ||
<Link | ||
href={`/portfolio?tag=${encodeURIComponent(tag || '')}`} | ||
className={`filter-btn ${selectedTag === tag ? 'active' : ''}`} | ||
> | ||
{tag} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default FilterList; |
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,50 +1,52 @@ | ||
import React from 'react'; | ||
import { MdExpandMore } from "react-icons/md"; | ||
import { projectTags } from '@/config/portfolio'; | ||
import { handleItemClick } from '@/lib/utils/filter-utils'; | ||
"use client"; | ||
|
||
import React, { useState } from 'react'; | ||
import { MdExpandMore } from 'react-icons/md'; | ||
import Link from 'next/link'; | ||
|
||
interface FilterSelectBoxProps { | ||
selectedValue: string; | ||
isSelectActive: boolean; | ||
setIsSelectActive: React.Dispatch<React.SetStateAction<boolean>>; | ||
setSelectedValue: React.Dispatch<React.SetStateAction<string>>; | ||
selectedTag: string; | ||
blogTags: string[]; | ||
} | ||
|
||
const FilterSelectBox: React.FC<FilterSelectBoxProps> = ({ | ||
selectedValue, | ||
isSelectActive, | ||
setIsSelectActive, | ||
setSelectedValue, | ||
}) => ( | ||
<div className="filter-select-box"> | ||
<button | ||
className={`filter-select ${isSelectActive ? 'active' : ''}`} | ||
onClick={() => setIsSelectActive(!isSelectActive)} | ||
> | ||
<div className="select-value"> | ||
{selectedValue || 'Select category'} | ||
</div> | ||
<div className="select-icon"> | ||
<MdExpandMore /> | ||
</div> | ||
</button> | ||
{isSelectActive && ( | ||
<ul className="select-list"> | ||
{projectTags.map((tag: string) => ( | ||
<li className="select-item" key={tag}> | ||
<button | ||
onClick={() => { | ||
handleItemClick(tag, setSelectedValue); | ||
setIsSelectActive(false); | ||
}} | ||
> | ||
{tag} | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
selectedTag, | ||
blogTags | ||
}) => { | ||
const [isSelectActive, setIsSelectActive] = useState(false); | ||
|
||
return ( | ||
<div className="filter-select-box"> | ||
<button | ||
className={`filter-select ${isSelectActive ? 'active' : ''}`} | ||
onClick={() => setIsSelectActive(!isSelectActive)} | ||
> | ||
<div className="select-value"> | ||
{selectedTag || 'Select category'} | ||
</div> | ||
<div className="select-icon"> | ||
<MdExpandMore /> | ||
</div> | ||
</button> | ||
{isSelectActive && ( | ||
<ul className="select-list"> | ||
{blogTags.map((tag: string) => ( | ||
<li className="select-item" key={tag}> | ||
<button | ||
onClick={() => { | ||
setIsSelectActive(false); | ||
}} | ||
> | ||
<Link href={`/portfolio?tag=${encodeURIComponent(tag || '')}`}> | ||
{tag} | ||
</Link> | ||
</button> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default FilterSelectBox; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
apps/web/src/components/portfolio/v2/filter-select-box.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.