Skip to content

Commit

Permalink
Ascending order of components
Browse files Browse the repository at this point in the history
Signed-off-by: Anand-Theertha <[email protected]>
  • Loading branch information
Anand-Theertha committed Jan 19, 2025
1 parent bcec762 commit 374357e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/components/SistentNavigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const TOC = () => {
location.pathname.includes("/components")
);

// Sorting the array of components by name
const sortedComponentArray = [...componentsData].sort((a, b) =>
a.name.localeCompare(b.name)
);

return (
<TOCWrapper>
<div className="go-back">
Expand Down Expand Up @@ -129,7 +134,7 @@ const TOC = () => {
{expandComponent && (
<div className="components-sublinks">
<li>
{componentsData.map((component) => (
{sortedComponentArray.map((component) => (
<li key={component.id}>
<Link
to={component.url}
Expand Down
5 changes: 3 additions & 2 deletions src/sections/Projects/Sistent/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
import { Link } from "gatsby";
import { componentsData } from "./content";


const SistentComponents = () => {
const [searchQuery, setSearchQuery] = useState("");
const { queryResults, searchData } = useDataList(
Expand All @@ -20,7 +19,9 @@ const SistentComponents = () => {
"id"
);

const compArray = queryResults;
const compArray = [...queryResults].sort((a, b) =>
a.name.localeCompare(b.name)
);

return (
<SistentWrapper>
Expand Down

0 comments on commit 374357e

Please sign in to comment.