Skip to content

Commit

Permalink
feat: WIP - changing sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunnatica committed Jul 20, 2024
1 parent 9073afc commit 12b2815
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions components/ResultsLayout/ResultsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ interface ResultsLayoutProps {

const ResultsLayout: React.FC<ResultsLayoutProps> = ({ results = [] }) => {
const [isInStarredTab, setIsInStarredTab] = useState(false);
// const [isSorted, setIsSorted] = useState(true);
const [selectedLanguage, setSelectedLanguage] = useState('');
const { starredReposIds } = useStarsContext();

Expand All @@ -90,8 +91,28 @@ const ResultsLayout: React.FC<ResultsLayoutProps> = ({ results = [] }) => {
}
}, [languages, selectedLanguage, repoList]);

// const resort = (repoList: GithubResult[]) => {
// repoList.sort((a, b) => {
// if (a.stargazers_count < b.stargazers_count) {
// return -1;
// }
// if (a.stargazers_count > b.stargazers_count) {
// return 1;
// }
// return 0;
// });
// setIsSorted(false);
// };

return (
<StyledResultsLayout>
{/* <button
onClick={() => {
resort(repoList);
}}
>
Change sort order
</button> */}
<ResultsHeader
changeTab={changeTab}
isInStarredTab={isInStarredTab}
Expand Down

0 comments on commit 12b2815

Please sign in to comment.