From 141e129865efe3cc1b72d9ef6897801585f94988 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Sun, 6 Oct 2024 00:43:57 -0400 Subject: [PATCH] Use Navigation Card Component on Homepage --- .../NavigationCard/NavigationCard.module.css | 6 --- .../Common/NavigationCard/NavigationCard.tsx | 46 +++++++++---------- .../Homepage/Homepage/Homepage.module.css | 27 +---------- .../components/Homepage/Homepage/Homepage.tsx | 41 ++--------------- frontend/src/pages/admin/index.module.css | 5 ++ frontend/src/pages/admin/index.tsx | 8 +++- frontend/src/pages/forms/index.module.css | 5 ++ frontend/src/pages/forms/index.tsx | 8 +++- 8 files changed, 51 insertions(+), 95 deletions(-) create mode 100644 frontend/src/pages/admin/index.module.css create mode 100644 frontend/src/pages/forms/index.module.css diff --git a/frontend/src/components/Common/NavigationCard/NavigationCard.module.css b/frontend/src/components/Common/NavigationCard/NavigationCard.module.css index eef844049..b104ea42e 100644 --- a/frontend/src/components/Common/NavigationCard/NavigationCard.module.css +++ b/frontend/src/components/Common/NavigationCard/NavigationCard.module.css @@ -1,9 +1,3 @@ -.content { - margin-left: 2rem; - margin-right: 2rem; - padding-top: 2rem; -} - @media (max-width: 900px) { .cardsContainer { display: flex; diff --git a/frontend/src/components/Common/NavigationCard/NavigationCard.tsx b/frontend/src/components/Common/NavigationCard/NavigationCard.tsx index a55633e7d..379e8a04c 100644 --- a/frontend/src/components/Common/NavigationCard/NavigationCard.tsx +++ b/frontend/src/components/Common/NavigationCard/NavigationCard.tsx @@ -19,30 +19,28 @@ export default function NavigationCard({ testID, items }: Props): JSX.Element { return (
-
- - {items.map( - ({ header, description, link, adminOnly }) => - (!isProduction || !adminOnly || hasAdminPermission) && ( - - - {header} - {description} - - -
- - - -
-
-
- ) - )} -
-
+ + {items.map( + ({ header, description, link, adminOnly }) => + (!isProduction || !adminOnly || hasAdminPermission) && ( + + + {header} + {description} + + +
+ + + +
+
+
+ ) + )} +
); } diff --git a/frontend/src/components/Homepage/Homepage/Homepage.module.css b/frontend/src/components/Homepage/Homepage/Homepage.module.css index 2c0123a27..bb94e5678 100644 --- a/frontend/src/components/Homepage/Homepage/Homepage.module.css +++ b/frontend/src/components/Homepage/Homepage/Homepage.module.css @@ -21,43 +21,18 @@ } .sectionDescription { - min-height: 6rem; + min-height: 4rem; margin-bottom: 1rem; } -.card { - display: flex; - width: 40%; - margin-left: 2rem; - margin-bottom: 2rem; -} - -.devCard { - margin-left: 2rem; - margin-bottom: 2rem; -} - @media (max-width: 900px) { .quickActions { display: flex; flex-direction: column; } - .card { - display: flex; - width: 100%; - margin-top: 2rem; - margin-bottom: 0; - } - .sectionDescription { min-height: 0; margin-bottom: 1rem; } - - .quick { - display: flex; - flex-direction: column; - align-items: center; - } } diff --git a/frontend/src/components/Homepage/Homepage/Homepage.tsx b/frontend/src/components/Homepage/Homepage/Homepage.tsx index a32c7a779..fc012871d 100644 --- a/frontend/src/components/Homepage/Homepage/Homepage.tsx +++ b/frontend/src/components/Homepage/Homepage/Homepage.tsx @@ -1,9 +1,9 @@ import Link from 'next/link'; import React from 'react'; -import { Button, Card, Divider } from 'semantic-ui-react'; +import { Divider } from 'semantic-ui-react'; import styles from './Homepage.module.css'; -import { NavigationCardItem } from '../../Common/NavigationCard/NavigationCard'; +import NavigationCard, { NavigationCardItem } from '../../Common/NavigationCard/NavigationCard'; const everyoneItems: readonly NavigationCardItem[] = [ { @@ -37,31 +37,6 @@ const devItems: readonly NavigationCardItem[] = [ } ]; -const NavCard = ({ - className, - header, - description, - link -}: NavigationCardItem & { className?: string }): JSX.Element => ( -
- - - {header} - {description} - - -
- - - -
-
-
-
-); - const Homepage: React.FC = () => (
@@ -88,11 +63,7 @@ const Homepage: React.FC = () => (

Check out your profile or log your attendance at a DTI event!

- - {everyoneItems.map((item) => ( - - ))} - +
@@ -105,11 +76,7 @@ const Homepage: React.FC = () => ( profile you use for your subteam.

- - {devItems.map((item) => ( - - ))} - +
diff --git a/frontend/src/pages/admin/index.module.css b/frontend/src/pages/admin/index.module.css new file mode 100644 index 000000000..aeb60ca12 --- /dev/null +++ b/frontend/src/pages/admin/index.module.css @@ -0,0 +1,5 @@ +.content { + margin-left: 2rem; + margin-right: 2rem; + padding-top: 2rem; +} diff --git a/frontend/src/pages/admin/index.tsx b/frontend/src/pages/admin/index.tsx index 26152ea00..699edea81 100644 --- a/frontend/src/pages/admin/index.tsx +++ b/frontend/src/pages/admin/index.tsx @@ -2,6 +2,8 @@ import NavigationCard, { NavigationCardItem } from '../../components/Common/NavigationCard/NavigationCard'; +import styles from './index.module.css'; + const navCardItems: readonly NavigationCardItem[] = [ { header: 'Member Information Review', @@ -65,5 +67,9 @@ const navCardItems: readonly NavigationCardItem[] = [ } ]; -const AdminIndex = (): JSX.Element => ; +const AdminIndex = (): JSX.Element => ( +
+ +
+); export default AdminIndex; diff --git a/frontend/src/pages/forms/index.module.css b/frontend/src/pages/forms/index.module.css new file mode 100644 index 000000000..aeb60ca12 --- /dev/null +++ b/frontend/src/pages/forms/index.module.css @@ -0,0 +1,5 @@ +.content { + margin-left: 2rem; + margin-right: 2rem; + padding-top: 2rem; +} diff --git a/frontend/src/pages/forms/index.tsx b/frontend/src/pages/forms/index.tsx index 3abad92ea..649544a19 100644 --- a/frontend/src/pages/forms/index.tsx +++ b/frontend/src/pages/forms/index.tsx @@ -2,6 +2,8 @@ import NavigationCard, { NavigationCardItem } from '../../components/Common/NavigationCard/NavigationCard'; +import styles from './index.module.css'; + const navCardItems: readonly NavigationCardItem[] = [ { header: 'Sign-In Form', description: 'Sign in to an event!', link: '/forms/signin' }, { @@ -32,5 +34,9 @@ const navCardItems: readonly NavigationCardItem[] = [ } ]; -const FormsIndex = (): JSX.Element => ; +const FormsIndex = (): JSX.Element => ( +
+ +
+); export default FormsIndex;