diff --git a/src/components/PackageList.tsx b/src/components/PackageList.tsx index 4eabb04..15f64d8 100644 --- a/src/components/PackageList.tsx +++ b/src/components/PackageList.tsx @@ -2,28 +2,36 @@ import { JSX } from 'react'; -import { Package } from '../types'; -import { PackageCard } from './PackageCard'; +import { + Package +} from '../types'; + +import { + PackageCard +} from './PackageCard'; interface PackageListProps { - packages: Package[]; - loading: boolean; + packages: Package[]; + loading: boolean; } -export function PackageList({ packages, loading }: PackageListProps): JSX.Element { - if (loading) { - return ( -
-
-
+export function PackageList({ + packages, + loading +}: PackageListProps): JSX.Element { + if (loading) return ( +
+
+
); - } - return ( -
- {packages.map((pkg) => ( - - ))} -
- ); -} \ No newline at end of file + const sortedPackages = [...packages].sort((a, b) => a.name.localeCompare(b.name)); + + return ( +
+ {sortedPackages.map((pkg) => ( + + ))} +
+ ); +}