Skip to content

Commit

Permalink
Merge pull request #2 from cityofasheville/development
Browse files Browse the repository at this point in the history
Updated print styles, added react-app-polyfill for IE
  • Loading branch information
6foot5 authored Aug 27, 2021
2 parents 7540fd8 + 29f6ed5 commit 71ab9f3
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 160 deletions.
71 changes: 9 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,17 @@
# Getting Started with Create React App
# Food Resources / Meal Sites

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This app is a resource meant to display locations providing food-related services to the community. Locations are shown as items in a list and/or as markers on a map. A print-friendly view is available as well.

## Available Scripts
Locations can be filtered according to characteristics such as geography, when open, or service provided.

In the project directory, you can run:
## Data

### `yarn start`
Information about all locations is maintained in a Google Sheet. This data is replicated and then published via ESRI REST services.

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
## Code

The page will reload if you make edits.\
You will also see any lint errors in the console.
This app is written in [React](https://reactjs.org/docs/getting-started.html).

### `yarn test`
## Map

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `yarn build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This app uses the [react-leaflet](https://react-leaflet.js.org/) and [leaflet](https://leafletjs.com/) libraries to manipulate an instance of [Open Street Map](https://www.openstreetmap.org/).
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"leaflet.markercluster": "^1.5.0",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-app-polyfill": "^2.0.0",
"react-dom": "^17.0.2",
"react-leaflet": "^3.2.1",
"react-leaflet-markercluster": "^3.0.0-rc1",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
crossorigin="anonymous">
</script>

<title>Find Meal Sites in the Buncombe County Area</title>
<title>Find Food Resources in the Buncombe County Area</title>

</head>

Expand Down
43 changes: 41 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ h3 {
border: none;
}

.leaflet-popup-content {
margin: 0 4px;
}

.card-body p[class*=" service-"] {
border: none;
}
Expand All @@ -393,15 +397,15 @@ h3 {
font-size: 2rem;
}

.nav-print-option {
/* .nav-print-option {
display: none;
}
@media (min-width: 992px) {
.nav-print-option {
display: inline-block;
}
}
} */

.full-width .resource-filter {
flex: 1;
Expand Down Expand Up @@ -494,4 +498,39 @@ h3 {
.accordion-button:not(.collapsed) {
color: var(--coa-black);
background-color: transparent;
}

td, th {
vertical-align: middle;
}

@media print {

body {
width: 21.59cm;
height: 27.94cm;
/* margin: 15mm 20mm 15mm 20mm; */
/* change the margins as you want them to be. */
}

tr {
page-break-inside: avoid;
}

header {
display: none;
}

td, th, .icon-print {
font-size: .8rem;
}

td {
min-width: 6cm;
}

.print-days-column {
min-width: 7cm;
}

}
2 changes: 1 addition & 1 deletion src/FilterCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function FilterCard(props) {
});
}

console.log(activeFiltersList);
// console.log(activeFiltersList);

const selectedFilters = activeFiltersList.map( (filter, i) => {
return(<li key={i} className="list-group-item filter-button" data-filter-value={filter.value} data-filter-type={props.filterName} title="Click to remove this filter" onClick={props.removeHandler}>{filter.text}</li>);
Expand Down
4 changes: 2 additions & 2 deletions src/FilterDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function FilterDropdown(props) {
});
}

console.log(activeFiltersList);
// console.log(activeFiltersList);

const selectedFiltersDropdown = activeFiltersList.map( (filter, i) => {
return (
Expand All @@ -76,7 +76,7 @@ function FilterDropdown(props) {
onClick={props.removeHandler}
>
{filter.text}
<i className="far fa-times-circle ms-2 icon-in-button"></i>
<i className="far fa-times-circle ms-2 icon-in-button" aria-hidden="true"></i>
</button>
</li>
);
Expand Down
2 changes: 1 addition & 1 deletion src/FilterOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import FilterDropdown from './FilterDropdown';

function FilterOptions(props) {
console.log(props);
// console.log(props);
const filterKeys = Object.keys(props.options);
const filterDropdownSet = filterKeys.map( (key, i) => {
let thisKey = `filterdropdown-${i}`;
Expand Down
2 changes: 1 addition & 1 deletion src/FilterOptionsBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import FilterCard from './FilterCard';

function FilterOptions(props) {
console.log(props);
// console.log(props);
const filterKeys = Object.keys(props.options);
const filterCardSet = filterKeys.map( (key, i) => {
let thisKey = `filtercard-${i}`;
Expand Down
4 changes: 2 additions & 2 deletions src/LocationCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function LocationCard(props) {
(props.context !== 'map') &&
<li className="list-group-item">{props.location.generalArea}</li>
}
<li className="list-group-item"><i className={iconClass}></i> {props.location.type === 'Students' ? 'Student Meals' : props.location.type}</li>
<li className="list-group-item"><i className={iconClass} aria-hidden="true"></i> {props.location.type === 'Students' ? 'Student Meals' : props.location.type}</li>
<li className="list-group-item">
<ul className="week-list" aria-label="Days of the week">
<li className={`day-of-week ${props.location.styleM}`} title={`${props.location.name} ${props.location.type} service is ${props.location.styleM === 'day-of-week--on' ? 'open' : 'closed'} on Monday`}><span className="day-label">M</span></li>
Expand All @@ -34,7 +34,7 @@ function LocationCard(props) {
</ul>
</li>
<li className="list-group-item">{props.location.hoursOpen}<br />{props.location.daysOpen}</li>
<li className="list-group-item"><a className="map-link text-dark" href={`https://www.google.com/maps/search/${q}`} title={`View location of ${props.location.name} on a Google Map`} target="_blank" rel="noopener noreferrer"><i className="fas fa-external-link-alt me-1"></i>Location</a>: {props.location.address}</li>
<li className="list-group-item"><a className="map-link text-dark" href={`https://www.google.com/maps/search/${q}`} title={`View location of ${props.location.name} on a Google Map in a new browser tab`} target="_blank" rel="noopener noreferrer"><i className="fas fa-external-link-alt me-1" aria-hidden="true"></i>Location</a>: {props.location.address}</li>
</ul>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/LocationStrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function LocationCard(props) {

return(
<tr className={`all-objects object-${props.location.OBJECTID} ${props.location.selectors}`}>
<td><h3>{props.location.name}</h3><i className={iconClass}></i> {props.location.type === 'Students' ? 'Student Meals' : props.location.type}</td>
<td>
<td className="px-3"><h3>{props.location.name}</h3><i className={`${iconClass} icon-print`} aria-hidden="true"></i> {props.location.type === 'Students' ? 'Student Meals' : props.location.type}</td>
<td className="px-3">
<ul className="week-list week-list--print" aria-label="Days of the week">
<li className={`day-of-week ${props.location.styleM}`} title={`${props.location.name} ${props.location.type} service is ${props.location.styleM === 'day-of-week--on' ? 'open' : 'closed'} on Monday`}><span className="day-label">M</span></li>
<li className={`day-of-week ${props.location.styleT}`} title={`${props.location.name} ${props.location.type} service is ${props.location.styleT === 'day-of-week--on' ? 'open' : 'closed'} on Tuesday`}><span className="day-label">T</span></li>
Expand All @@ -29,7 +29,7 @@ function LocationCard(props) {
</ul>
{props.location.hoursOpen} | {props.location.daysOpen}
</td>
<td>Area: {props.location.generalArea}<br /><a className="map-link text-dark" href={`https://www.google.com/maps/search/${q}`} title={`View location of ${props.location.name} on a Google Map`} target="_blank" rel="noopener noreferrer">Location</a>: {props.location.address}</td>
<td className="px-3">Area: {props.location.generalArea}<br /><a className="map-link text-dark" href={`https://www.google.com/maps/search/${q}`} title={`View location of ${props.location.name} on a Google Map in a new browser tab`} target="_blank" rel="noopener noreferrer">Location</a>: {props.location.address}</td>
</tr>
)
}
Expand Down
3 changes: 2 additions & 1 deletion src/MapLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class MapLayout extends React.Component {
// Need the leaflet container to re-size itself when "show/hide list" toggle happens
if (this.mapRef !== null) {
this.mapRef.invalidateSize();
console.log('Invalidating Map Size');
}
}

Expand Down Expand Up @@ -90,7 +91,7 @@ class MapLayout extends React.Component {
whenCreated={map => {
// https://sean-rennie.medium.com/migrating-react-leaflet-from-v2-to-v3-12d6088af191 (explains new ref-less map control options)
// https://github.com/PaulLeCam/react-leaflet/issues/841#issuecomment-779048091 (example of using whenCreated prop of MapContainer)
console.log('trying to invalidate')
console.log('Map whenCreated');
this.mapRef = map;
}}
>
Expand Down
Loading

0 comments on commit 71ab9f3

Please sign in to comment.