-
Notifications
You must be signed in to change notification settings - Fork 30
Site Architecture
All components and pages that make up the site are located in src/
, so that will be the "root" reference in this Overview description. The entry point into the site application is index.js
, which applies Google Analytics tracking through GA4React
and Material UI styling theme through createMuiTheme
(along with importing theme-mui.js
). Site-wide styling that does not belong in the theme is defined in styles.js
. The actual site application is defined in the App
component in App.js
.
The App
component imports a Layout
that consists of a Header
, the current page being displayed, and a Footer
. Navigation menu structure in the Header
and Footer
is defined in navigation.js
. The other major part of App
is list of routes that provides info on how to navigate to all pages on the site. App
also contains cookie popup functionality.
Any components that are used in multiple places throughout the site or are part of the general site layout are in components/
. Components that make up the pages of the site are reside in pages/
.
Purpose: current home page that will be the landing page at site launch
Path: src/pages/Home
Structure:
-
index.js
is the parent file that contains its own style section andHome
,MarketingSection
, andCallToAction
components -
sections
subdirectory containsNotableUsersSection.js
andTrendingTopicsSection.js
components - There is a
notableUsers
list that is defined inNotableUsersSection.js
that contains info for CTI contributor orgs -
index.js
importsNotableUsersSection
andTrendingTopicsSection
. It also importsGetStartedCard
fromsrc/components
-
Home
component contains all of the home page and displays the following components from top to bottom:MarketingSection
,CallToActionSection
,NotableUsersSection
,TrendingTopicsSection
,GetStartedCard
Purpose: It shows the steps how to add topic tags to your project.
Path: src/pages/HowToAdd
Structure:
-
HowToAdd
component in the main fileindex.js
, which contains its own style section andImageComponent
component,SettingsGearIcon
component. -
ImageComponent
component insrc/components
usesCardMedia
Material UI component for displaying the images. -
SettingGearIcon
component insrc/components
uses svg which is used to define vector-based-graphics and path is an element in svg library which defines a path that starts from a position and ends to a particular position. The path element uses attribute d which uses M which is used for moving a point to a certain location.
Purpose: provides information on the organization's project
Path: src/pages/About
Structure:
-
About
is the parent component that is exported toApp.js
to render this page in the DOM. -
index.js
is the parent file containing formatting and an object for mapping the images of the page - A
Grid
component contains aniframe
slideshow explaining various aspects of the project -
styles.js
contains the styling for the page
Purpose: provides site navigation Links
and subLinks
in two display sizes
Path: src/components/Header
Structure:
-
Header
is the parent component exported from theindex.js
file contained within the Header folder. - Header is exported to the
Layout
component found undersrc/components/common/Layout.js
where it is exported usingwithRouter
fromreact-router-dom
. The Layout component wraps theSwitch
component imported from thereact-router-dom
package in theApp
component which handles the routing insrc/App.js
. - The
Header
component is broken down into several smaller components with separate files:index
,HeaderLarge
,HeaderSmall
,DropdownList
,SearchContainer
,NavLink
andNavSublink
. Several files make use of thenavigation
array exported from thesrc/navigation.js
file. The Header folder also contains a separatestyles.js
sheet which provides styling to each of the components. -
index.js
exports theHeader
component as default and is also where the switch between large and small displays is handled utilizing theHidden
component from themui
library. -
HeaderLarge
feeds the values to theNavLink
andNavSublink
components from thenavigation
array via the.map
method. It also houses the image link of the CTI logo to the landing page and a button link to theSearch Projects
screen. -
HeaderSmall
contains the same links to search and the landing page as HeaderLarge, as well as passing values using the navigation array, but handles the display via ahamburger
button allowing for visible or hidden links. -
SearchContainer
is a component that exports a button link toSearch Projects
screen. -
DropdownList
utilizes severalmui
packages to handle the functionality, display and style of the sublinks under each page heading. -
NavLink
is a component built off theLink
component frommui
and theNavLink
component (imported as 'NaviLink') fromreact-router-dom
. The styling is built using hooks from thematerial-ui-popup-state
package. - The
NavSublink
component decides between external and internal links, with internal links being handled by a modifiedLink
component (imported as RouterLink) fromreact-router-dom
. Styling of thehover state
of links in the large display dropdown menus are handled in this file.
Purpose: provides site navigation links in three configurations at the foot of each page
Path: src/components/Footer
Structure:
-
Footer
is the parent component exported from theindex.js
file contained within the Footer folder. - The Footer component is imported into the
Layout
component found undersrc/components/common/Layout.js
where it is exported usingwithRouter
fromreact-router-dom
. The Layout component wraps theSwitch
component imported from thereact-router-dom
package in theApp
component which handles the routing insrc/App.js
. - The
Footer
component is broken down into several smaller components with separate files:index
,FooterLarge
,FooterSmall
,LinkList
,DropdownList
,SocialSection
,SubscribeSection
, andAnnotation
. Several files make use of thenavigation
array exported from thesrc/navigation.js
file. The Footer folder also contains a separatestyles.js
sheet which provides styling to each of the components. -
index.js
exports theFooter
component and is also where the switch between large and small displays is handled utilizing theHidden
component from themui
library. -
FooterLarge
feeds values to theLinkList
component from thenavigation
array via the.map
method, which is used for medium and larger displays. It also houses the large display versions of theSocialSection
and theSubscribeSection
.FooterSmall
feeds the same links as FooterLarge, only passes them to theDropdownList
component which is designed for small and extra small displays. It uses the small display versions of theSocialSection
and theSubscribeSection
. BothDropdownList`` and
LinkListcreate custom links built off the
Linkcomponent from the
react-router-dom``` library. -
SocialSection
is a component that houses links for the Civic Tech Index social media sites. - The
SubscribeSection
component usesaxios
to add users’ email addresses to the CTI database. - The
Annotation
is a simple component providing a message at the bottom of the footer as well as links to CTI’s GitHub page and privacy policy.
Purpose: provides the list of FAQ questions
Path: src/pages/Faq
Structure:
-
Faq
component is the main file it hasindex.js
anduseSearchFaq.js
. -
index.js
file has its own style section and it fetches the FAQ questions from axios.get(url) with a URL from an API endpoint which returns a response object and axios.post(url, requestBody) , with an URL from API endpoint and requestBody is passed which has question, answer and view_count attributes. -
index.js
importsFAQCard
Component fromsrc/components
andSearchBar
from/SearchProjects/SearchBar
. -
FAQCard
component hasaccordianSection.js
which has its own style section and it uses material UI accordion component which shows and hide sections of content on a page andindex.js
importsaccordianSection.js
which is used to display the Faq questions and answers and it also uses Pagination material UI component for displaying the Faq questions page wise. -
SearchProjects
folder fromsrc/pages/
is the main file and it hasSearchBar.js
which has its own style section and search bar component implemented for displaying the search bar on header.
Purpose: provides contact form for collecting the contact information.
Path: src/pages/Contact
Structure:
-
Contact
component is the main file and it hasindex.js
. -
index.js
file has its own style section and importsGenericHeaderSection
fromsrc/components
which is used for displaying mainTitle,
children and breadCrumbLinks. -
index.js
file uses CardMedia component which embeds google docs for displaying the contact form.
Purpose: It displays the unaffiliated, affiliated organizations and index contributors.
Path: src/pages/Contributors
Structure:
-
index.js
is the main file which importsNavBreadcrumbs
,TitleSection
andGetStartedCard
all from/components
andOrganizationSearch
,Affiliated
andUnaffiliatedOrganizations
from/Contributors
. -
NavBreadcrumbs
in/components
is used for displaying the navbreadcrumbs. -
TitleSection
in/components
for displaying the title of the page. -
GetStartedCard
in/components
for displaying the bottom section of the page. -
OrganizationSearch
in/Contributors
is used for searching affiliated and unaffiliated organizations. -
UnaffiliatedOrganizations
component in/Contributors
is used for displaying unaffiliated organizations. -
Affiliated
component in/Contributors
is used for displaying the affiliated organizations, it also importsAffiliatedOrganizations
which is used to filtering the parent and child data and displaying on the page.
The Wiki is a working document and we would love to improve it. Please compile any questions and suggestions you may have and submit it via creating an issue on our project board.