Skip to content

Conversation

@Waqibsk
Copy link
Contributor

@Waqibsk Waqibsk commented Jun 1, 2025

Description

  1. Added Sortby(name,stars,forks) option
  2. here are a couple of screenshots

Screenshot (31)
Screenshot 2025-06-01 213650

Fixes issue #8 (partially ......search bar not yet implemented )

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

1.On larger screens, the dropdown menu appears on hover.
2.On smaller screens, it appears on click.

@harshkhandeparkar
Copy link
Member

Few suggestions:

  • Ascending/descending can be a simple icon button next to the dropdown
  • It is better to use shades of grey rather than completely inverting the colors
  • Bold is unnecessary
  • The dropdown can be styled a little (the default borders/outlines/box shadows or whatever look bad)

@Waqibsk
Copy link
Contributor Author

Waqibsk commented Jun 11, 2025

Screenshot 2025-06-11 202828
Thank you for the feedback , here is the modified version ...
Let me know if there's anything else to change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better/easier to just use a library like react-icons or fontawesome.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even just use something stupid like ^ and v lol, or check if the font supports emojis

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emojis look like garbage on Windows. And icons can be used for other things later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case react-icons is already a dependency, so should be an easy change @Waqibsk

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Jun 14, 2025

Screenshot 2025-06-11 202828 Thank you for the feedback , here is the modified version ... Let me know if there's anything else to change

Looks great! Is the arrow for representing asc/desc? In that case it would be better to separate it from the dropdown since it looks like it is the dropdown's icon.

Copy link
Collaborator

@Majestic9169 Majestic9169 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even just use something stupid like ^ and v lol, or check if the font supports emojis

.gh-card-grid.all {
grid-template-columns: repeat(3, 1fr);

grid-template-columns: repeat(2, 1fr);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you make this more responsive? 3, 1fr on large screens, 2 on medium etc

Comment on lines 1 to 61
import React, { useState } from "react";
import "../styles/components/SortDropdown.css";
import downArrow from "../assets/down.png";
import upArrow from "../assets/up-arrow.png";
import { SortDropdownProps } from "../utils/types";
const SortDropdown: React.FC<SortDropdownProps> = ({
setSortField,
setSortType,
sortField,
sortType,
}) => {
const [showMenu, setShowMenu] = useState(false);

const toggleSort = () => {
setSortType(sortType === "desc" ? "asc" : "desc");
}
const toggleDropdown = () => {
setShowMenu(!showMenu);
};
const handleSortField = (field: string) => {
setSortField(field);
};

return (
<div className={`dropdown ${showMenu ? "show" : ""}`}>
<div className="sort-button">
<button disabled={window.innerWidth >= 760} onClick={toggleDropdown}>
Sort by:{" "}{sortField.charAt(0).toUpperCase()+sortField.slice(1)}
</button>
<div className="sort-Arrow-container" onClick={(e) => {
e.stopPropagation();
toggleSort();
}}>
<img src={sortType === "desc" ? downArrow : upArrow} className="sort-Arrow" alt="▼" />

</div>

</div>
<div className={`dropdown-content ${showMenu ? "show" : ""}`}>
<div className={`dropdown-item ${"name" === sortField ? "selected" : ""}`} onClick={() => handleSortField("name")}>
{" "}

Name
</div>
<div className={`dropdown-item ${"forks" === sortField ? "selected" : ""}`} onClick={() => handleSortField("forks")}>
<span

></span>
Forks
</div>
<div className={`dropdown-item ${"stars" === sortField ? "selected" : ""}`} onClick={() => handleSortField("stars")}>

Stars
</div>

</div>
</div>
);
};

export default SortDropdown;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add another field? current behaviour is to fetch repo data by last updated, which means we get to see currently active repos on the top

in get_repos.py

    # notice sort:updated
    response = requests.get(url, params={'sort':'updated', 'per_page': 100, 'type': 'public'}) 

if that could be the default that would be great, feel free to add other fields if you like

also while your dropdown is nice and simple, could you look into a more modular filter system like as below?

image

let me know if you feel like any other fields are necessary. If you think these are enough then a dropdown is sufficient

const Projects = () => {
const repoList: REPO_DATA_TYPE[] = RepoData as REPO_DATA_TYPE[]

const [sortField, setSortField] = useState("name");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set the default field as the updated one as mentioned above

const repoList: REPO_DATA_TYPE[] = RepoData as REPO_DATA_TYPE[]

const [sortField, setSortField] = useState("name");
const [sortType,setSortType]=useState("asc")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for forks, stars and updated it would be better to set the default order as descending

@Waqibsk
Copy link
Contributor Author

Waqibsk commented Jun 15, 2025

Made the changes ...
Screenshot (32)

@Majestic9169
Copy link
Collaborator

image

slight nitpick the dropdown takes full width on smaller screens so hovering anywhere in that empty area opens up the menu, but idc rn

merging, good work again

@Majestic9169 Majestic9169 merged commit 24c2012 into metakgp:main Jun 15, 2025
1 check passed
@Waqibsk
Copy link
Contributor Author

Waqibsk commented Jun 15, 2025

hey the dropdown was not working in smaller screens ....so pls look into #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants