Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React SEPTA fare calculator challenge - Luke Yamasaki #170

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
09a2d80
Setting up files
Luke-Yamasaki Aug 18, 2022
13bbc23
Ready to work on components
Luke-Yamasaki Aug 18, 2022
cdfad3d
Testing navbar
Luke-Yamasaki Aug 18, 2022
69cceb1
Handling routes
Luke-Yamasaki Aug 18, 2022
c6dc5e6
Adding context switches
Luke-Yamasaki Aug 18, 2022
46e6643
Adding switches to the navbar
Luke-Yamasaki Aug 18, 2022
e2e8a39
Adding bare bones html
Luke-Yamasaki Aug 18, 2022
a95a6c3
Added customization to navbar
Luke-Yamasaki Aug 18, 2022
433a4ae
Switching to fares page
Luke-Yamasaki Aug 18, 2022
c09ffe9
Added promo message
Luke-Yamasaki Aug 18, 2022
342001b
Entered skeleton html for form
Luke-Yamasaki Aug 18, 2022
ad0af75
Styling
Luke-Yamasaki Aug 18, 2022
0071f50
Almost done with styling
Luke-Yamasaki Aug 18, 2022
bbcc227
Almost done with styling everything
Luke-Yamasaki Aug 20, 2022
e7c1827
Calculation is almost done
Luke-Yamasaki Aug 20, 2022
581468e
Adding final pop up
Luke-Yamasaki Aug 20, 2022
2a0f660
Adding sticky positioning
Luke-Yamasaki Aug 20, 2022
73dda73
Finished and looking to polish styling and refactoring
Luke-Yamasaki Aug 20, 2022
d436c23
Finished with the assessment
Luke-Yamasaki Aug 20, 2022
01664c2
Merge pull request #1 from Luke-Yamasaki/Fares
Luke-Yamasaki Aug 20, 2022
c1af9d5
Merge pull request #2 from Luke-Yamasaki/Navbar
Luke-Yamasaki Aug 20, 2022
3b10cbd
Adding error message styling
Luke-Yamasaki Aug 20, 2022
afd8cbe
Merge pull request #3 from Luke-Yamasaki/Fares
Luke-Yamasaki Aug 20, 2022
5b7eccf
Update README.md
Luke-Yamasaki Aug 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
54 changes: 54 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SEPTA Rail Fare Calculator Challenge

## Hello! Thank you so much for giving me the opportunity to take this coding assessment.
## I would like to briefly walkthrough my solution to this challenge.

### Tech stack
* React (I would employ Next.js on the entire website, but SEO is not necessary for a widget.)
* React Router and Context API
* Module CSS (Eliminates class name collisions and improves performance.)

### Resources I consulted
* [Think Company Development Standards](https://standards.thinkcompany.dev/)
* [SEPTA Fares](http://www.septa.org/fares/ticket/index.html)
* [SEPTA Logo (SVG)](https://commons.wikimedia.org/wiki/File:SEPTA.svg)
* [CSS Global reset](https://meyerweb.com/eric/tools/css/reset/)

### Wireframe
* I quickly made a gameplan for styling with Adobe XD
<img width="1680" alt="Screen Shot 2022-08-20 at 7 01 49 PM" src="https://user-images.githubusercontent.com/89368363/185768843-74b4cd77-f627-4f55-9bbd-75f1dfec5b9c.png">

### Research
* Checked the SEPTA website
* Called SEPTA to double check information

### Modularity
* I structed modules by pairing a component with a module CSS file to make CSS manageable
* I employed React as a frotned library to quickly create components
* I aimed to create small components
* I employed React Context API to manage light and dark mode
* I also employed a language switch to change English to Spanish and vice versa

### JSON strings
* To switch languages, I removed the majority of titles, labels and support text from JSX files
* I made switching languages more modular and parsible to the human eye
* This file setup allows for increased developer experience
* If CSS-in-JS libraries are employed, JSON makes passing CSS props highly efficient

### Managing state
* I managed components with the useState hook
* I managed side effects with the useEffect hook
* I incorporated functional programming to make functions more DRY

### Error handling
* I accounted for various user paths and made sure to catch errors
* I added asterisks at the beginning of message to signal that there was an error without relying just on the color red
* I made sure to add a green color for messages that will not throw an error but are useful information to a user

### Preparing for backend
* Double checked data before preparing a JSON string for the backend
* Backend API calls with be an asynchronous function
* State variables will be converted to an object and passed as a JSON string via an HTTP request
* The backend developer will be able to parse data easily and the keys match the original JSON file for zones and fares

## Thank you!
Loading