Living Lab Website¶
This is the Living Lab Website version 3. This has been created by Frinze Erin Lapuz for the Living Lab project.
Technology Stack¶
This website has been created using the following technologies: - React - a UI library in JavaScript that utilizes the power of Client-Side Rendering for Single Page Application - Next - a library of React that handles initial Server-Side Rendering, and also allows caching of the Static HTML and CSS generated readily to be served including the pages in the dynamic routes - MaterialKit + MaterialUI - a CSS library created by Creative Tim that provides easy and ready to use components to create website layout very fast
Why Did I Use This Technology Stack?¶
I used this technology stack for multiple reasons that I will list in the order of importance:
-
Custom Reusable Components = Faster Development and Better Maintainability - in this project, there are a lot of repetitions of layout in multiple pages such as header and footer. Moreover, some pages such as the "Accelerated Life Testing" pages content are repeated layout with the difference only the content. Hence, I needed a way in order to create reusable components so that I will not have to recreate or copy paste code that I have already written. This also means that one change of code, will change all the related pages. This is the power of React.
-
Template Components = Faster Development and Responsive Design - I needed a way to create responsive website that will look good regardless of whether the website is being viewed in a desktop, laptop, tablet or mobile phones. Furthermore, developing own components with good styling and also responsive takes too much time. Hence, the use of CSS library is important for this project. This is satisfied with MaterialKit + MaterialUI
-
Static Site With Client-Side Rendering = Website Speed Perfomance and Security - I needed a way to create a website that is fast and secure. The original website is a simple HTML and CSS website, and only contained 3 pages which is good especially for its simplicity for speed and security. In my side, I had to add approximately 18 pages which means that I needed a way to reduce the loading speed without compromising the original security it had. I used Next in order to cache the static HTML and CSS for server-side rendering while still maintaining the client-side rendering for the speed. Since the entire site is static, there is no dynamicness or backend services that can be hacked to change the content of the website without going through the source code.
If this reasoning of mine does not satisfy you, feel free to contact me and have a discussion about this.
Quick start¶
- Clone the repo:
git clone https://github.com/uwasystemhealth/livinglab-site-v3.git
. - Install the dependencies:
npm install
oryarn install
- To build the static files:
npm run build
oryarn build
- To start development server:
npm run dev
oryarn dev
- To start a normal server:
npm run start
oryarn start
File Structure¶
This is what you will see in the directories. Note: there will be comments for VERY VERY IMPORTANT FILES. (To Be Updated)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
Additional Notes¶
File-Based Routing¶
pages
directory is a very important folder as it determines the routing of the website. This can only contain "PAGE" components, and may contain static props fetching especially the dynamic pages.
More info about routing here and about dynamic routing here.
File-Splitting Guide¶
This project components are mainly divided into three main parts: components
, pages
, pages-sections
:
1. components - are very basic components that could be reused anywhere
2. pages-sections - are sections of pages. For example the pages/index
are divided into multiple sections seen in pages-sections/HomePage-Sections
3. pages - these are accessible routes. The names of this files depends on what you want the page URL to look like. This is related to File-Based Routing.
File-Content Convention¶
The file content writing has a convention that follows: 1. Importing of Modules 2. Setting Up Components 3. Component Exporting Content 4. (Optional - used only for dynamic pages) Setting Up How The Component will Be Processed as a page. Read more about this here 5. Default Export of 3
Take a look at component/roadmaps/StepperPathway.js
as an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Directory Naming In Some Directory¶
In some folder such as components
, pages-section
, and public/img
. There will occasionally be directories that are lower caps, these are directories that follows the same format as of the one in the pages
directory for easy reference.
Environment Variable¶
The format of the environment variable is this. (As of July 2020, only contains details for mail sending)
1 2 3 4 |
|
Docker Deploy¶
Make sure you have docker installed and running. Type the command:
This will build an image in docker
1 |
|
Run the docker compose to run the image with configurations in "detached mode" - run in background
1 |
|
Requirements Document May 2020¶
This document is the requirements document for the start of the website. The sketches is done in Figma.
Colors and Branding¶
Can be found here.
Template Licensing¶
-
Copyright 2020 Creative Tim (https://www.creative-tim.com/?ref=njsmk-readme)
-
Licensed under MIT (https://github.com/creativetimofficial/nextjs-material-kit/blob/master/LICENSE.md)