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

TCL30-69 - Add icons to slider to settings page #36

Merged
merged 6 commits into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
42 changes: 35 additions & 7 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ main > h1 + * {
padding: 0 0.5rem;
}

.view__title {
text-align: left;
color: var(--primary-color);
font-family: var(--font-family-headings);
font-weight: 700;
}

.view__header {
background-color: rgb(64, 138, 250);
color: white;
Expand Down Expand Up @@ -406,7 +413,6 @@ a.active {
Settings
\*--------------------------------------------------------------------------*/
.settings-subheader {
max-width: 60ch;
margin-left: auto;
margin-right: auto;
margin-top: 2rem;
Expand All @@ -417,32 +423,54 @@ a.active {
color: #1c2334;
}

.settings__instruction {
text-align: justify;
}

.settings__message {
height: 60vh;
display: flex;
justify-content: center;
align-items: center;
}

.slider-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 3rem;
width: 95%;
}

.slider {
width: 100%;
max-width: 500px;
height: 50px;
margin: 0 auto;
}

.slider + * {
margin-top: 5rem;
margin-top: 4rem;
}

.slider__options {
display: flex;
justify-content: space-between;
width: 100%;
}

.slider__transport {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}

.thumb {
box-sizing: border-box;
top: 1px;
width: 50px;
height: 48px;
border: 5px solid gray;
background-color: black;
border: 5px solid black;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to have the border be the secondary color instead of black.

background-color: var(--primary-color);
color: white;
font-size: 0.9em;
text-align: center;
Expand Down
3 changes: 3 additions & 0 deletions src/assets/walk-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 43 additions & 25 deletions src/pages/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { useContext } from 'react';

import ReactSlider from 'react-slider';
import { HeaderNav } from '../components/HeaderNav';

import { ReactComponent as WalkIcon } from '../assets/walk-icon.svg';
import { ReactComponent as CarIcon } from '../assets/car-icon.svg';
import { ReactComponent as BicycleIcon } from '../assets/bicycle-icon.svg';
import { LocationsContext } from '../context/LocationsContext';
import { MapCenterContext } from '../context/MapCenterContext';

Expand All @@ -18,18 +20,29 @@ export const SettingsPage = () => {
<>
<HeaderNav />
<div className="view__content">
<h1>Settings</h1>
<p className="settings-subheader">
{userLocationShared
? `Adjust how frequently the app
refreshes with new data`
: `Please share your location to adjust how frequently the app
refreshes with new data`}
</p>
</div>
{userLocationShared ? (
<>
<div className="view__content">
<h1 className="view__title">SETTINGS</h1>
<div className="settings-subheader">
{userLocationShared ? (
<div className="settings__instructions">
<p className="settings__instruction">
Adjust how frequently the app refreshes with new information.
</p>
<br />
<p className="settings__instruction">
This is effective when you are actively sharing your location,
and can improve battery life of your device.
</p>
</div>
) : (
<p className="settings__message">
Please share your location to adjust how frequently the app
refreshes with new data
</p>
)}
</div>

{userLocationShared ? (
<>
<div className="slider-container">
<ReactSlider
className="slider"
Expand All @@ -45,19 +58,24 @@ export const SettingsPage = () => {
<div {...props}>{state.valueNow}</div>
)}
/>
<div className="slider__options">
<div className="slider__transport">
<CarIcon />
<p className="slider__mode">Car / Train</p>
</div>
<div className="slider__transport">
<BicycleIcon />
<p className="slider__mode">Bicycle</p>
</div>
<div className="slider__transport">
<WalkIcon />
<p className="slider__mode">Walk</p>
</div>
</div>
</div>

<p className="slider__instructions">
Recommended settings are based on expected speed of transportation
</p>
<ul className="slider__legend">
<li>Car/Train: 0 seconds</li>
<li>Bicycle: 15 seconds</li>
<li>Walking: 30 seconds</li>
</ul>
</div>
</>
) : null}
</>
) : null}
</div>
</>
);
};