-
+ {!isLoading && !hasError && people.length > 0 &&
}
-
+ {isLoading &&
}
-
Something went wrong
+ {hasError && (
+
Something went wrong
+ )}
-
There are no people on the server
+ {!isLoading && !hasError && people.length === 0 && (
+
+ There are no people on the server
+
+ )}
-
There are no people matching the current search criteria
+ {noPeopleMatching && (
+
There are no people matching the current search criteria
+ )}
-
+ {tableOfPeople && (
+
+ )}
diff --git a/src/components/PeopleTable.tsx b/src/components/PeopleTable.tsx
index fdd814b4a..dbaa56ebf 100644
--- a/src/components/PeopleTable.tsx
+++ b/src/components/PeopleTable.tsx
@@ -1,5 +1,49 @@
/* eslint-disable jsx-a11y/control-has-associated-label */
-export const PeopleTable = () => {
+import { useSearchParams } from 'react-router-dom';
+import { Person } from '../types';
+import { PersonLink } from './PersonLink';
+import { SearchLink } from './SearchLink';
+
+type Props = {
+ people: Person[];
+ selectedSlug?: string;
+};
+
+export const PeopleTable = ({ people, selectedSlug }: Props) => {
+ const [searchParams] = useSearchParams();
+
+ const sort = searchParams.get('sort');
+ const order = searchParams.get('order');
+
+ const getSortParams = (field: string) => {
+ if (sort !== field) {
+ return {
+ sort: field,
+ order: null,
+ };
+ }
+
+ if (sort === field && order !== 'desc') {
+ return {
+ sort: field,
+ order: 'desc',
+ };
+ }
+
+ return {
+ sort: null,
+ order: null,
+ };
+ };
+
+ const getSortIcon = (field: string) => {
+ if (sort !== field) {
+ return 'fas fa-sort';
+ }
+
+ return order === 'desc' ? 'fas fa-sort-up' : 'fas fa-sort-down';
+ };
+
return (
);
diff --git a/src/components/PersonLink.tsx b/src/components/PersonLink.tsx
new file mode 100644
index 000000000..9a2788bfd
--- /dev/null
+++ b/src/components/PersonLink.tsx
@@ -0,0 +1,19 @@
+import { Link, useLocation } from 'react-router-dom';
+import { Person } from '../types';
+
+type Props = {
+ person: Person;
+};
+
+export const PersonLink = ({ person }: Props) => {
+ const location = useLocation();
+
+ return (
+
+ {person.name}
+
+ );
+};