-
Notifications
You must be signed in to change notification settings - Fork 185
SEPTA Fare Calculator - First Iteration #208
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
base: master
Are you sure you want to change the base?
SEPTA Fare Calculator - First Iteration #208
Conversation
Initialize and install the empty NPM package.
- react, react-dom - babel, presets - webpack, webpack-cli, webpack-dev-server, and deps
Reduce browser inconsistencies. For more info, see: https://meyerweb.com/eric/tools/css/reset/
Starting with mobile first design. Later, we will add the tablet and desktop designs.
Styled for mobile device.
The IS_LOCAL_FARES global env-var is set to true so the ./data/fares.json file is being used at the moment. Also configuring Axios to use the BACKEND_URL global env-var.
Affected Inputs: - DropdownSelect (previously known as Dropdown) - RadioSelect (previously known as RadioButton) - InputBox
Specifically: - Description Meta: SEO - CSS: Performance, accessibility
| ) ) } | ||
| </select> | ||
| <span ref={ spanRef } style={ spanStyle }> | ||
| { dayTypeLabelLookup[ value ] || value } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, @andyknapp.
This is where the "1" is being rendered. When I added the "resize width" functionality for the DropDown component, I based the width on the text length for the "When are you riding" dropdown.
However, the changes didn't account for the "Where are you going" drop-down. Hence the "1", since it can't be found in the dayTypeLabelLookup dictionary.
To fix this, I would need something like the following:
import React, { useEffect, useId, useRef } from 'react';
...
function DropDownSelect( { id, label, options, value, helperText, onChange } ) {
...
// Note: May need to be optimized.
const longestLabel = options.reduce( ( longest, option ) => {
return option.label.length > longest.length ? option.label : longest;
}, '' );
...
return (
<>
...
<span ref={ spanRef } style={ spanStyle }>
{ longestLabel }
</span>
</>
);
}
export default DropDownSelect;
Description
The changes in this pull-request implement the first iteration of the SEPTA Fare Calculator.
Test Instructions
Important
Ensure Node
v23.11.1is installed before proceeding with the following instructions../septa-fare-calculatordirectory.v23.11.1(Optional: Runnvm use).npm install.npm start.Summary
I spent approximately 8 hours (on and off) working on this app.
I started developing the app's responsive design with mobile-first in mind. However, due to time limitations, I didn't get a chance to add the
tabletanddesktopdesigns. That would have been a matter of using CSS breakpoints (e.g.@media (min-width: ...) { ... }) and modifying the CSS values accordingly.I also left quite a few
TODOsthat would need to be followed up, given enough time. Here are a few examples:fares.jsonfile.DropdownSelectcomponent:fontSizeCSS value. We want to avoid having to update the font-size in more than one place.Costcomponent:I had a chance to test on Google Chrome (including for iOS), Safari (including for iOS), and Microsoft Edge but not Chrome for Android.
Finally, if given more time, I would have liked to spent more time ensuring accessibility. However, I think I covered some of the more important content.