-
Notifications
You must be signed in to change notification settings - Fork 7
Nav dropdown mobile #254
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
Open
shaoc23
wants to merge
2
commits into
main
Choose a base branch
from
nav-dropdown-mobile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Nav dropdown mobile #254
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .dropdown { | ||
| position: relative; | ||
| display: inline-block; | ||
| z-index: 1001; /* Add this */ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import React, { useState } from "react"; | ||
| import DropdownButton from "../DropdownButton/DropdownButton"; | ||
| import DropdownContent from "../DropdownContent/DropdownContent"; | ||
| import "./Dropdown.css"; | ||
|
|
||
| const Dropdown = ({ buttonText, content }) => { | ||
| const [open, setOpen] = useState(false); | ||
| const toggleDropdown = () => setOpen(!open); | ||
| const closeDropdown = () => setOpen(false); | ||
|
|
||
| return ( | ||
| <div className="dropdown"> | ||
| <DropdownButton toggle={toggleDropdown} open={open}> | ||
| {buttonText} | ||
| </DropdownButton> | ||
|
|
||
| <DropdownContent open={open}> | ||
| {/* ✅ Wrap the content with a click handler */} | ||
| <div | ||
| onClick={(e) => { | ||
| // only close when clicking a link, not when toggling dropdown | ||
| if (e.target.tagName === "A") { | ||
| closeDropdown(); | ||
| } | ||
| }} | ||
| > | ||
| {content} | ||
| </div> | ||
| </DropdownContent> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Dropdown; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* .dropdown-btn{ | ||
| display:flex; | ||
| align-items:center; | ||
| width:fit-content; | ||
| padding:1rem; | ||
| background-color:white; | ||
| border-radius: 0.5rem; | ||
| cursor:pointer; | ||
| } | ||
|
|
||
| .toggle-icon { | ||
| display:flex; | ||
| align-items:center; | ||
| justify-content:center; | ||
| margin-left:1rem; | ||
| } | ||
|
|
||
| .button-open { | ||
| border: #578FCA 2px solid; | ||
|
|
||
| } */ | ||
|
|
||
| .dropdownbtn { | ||
| display: flex; | ||
| align-items: center; | ||
| width: fit-content; | ||
| margin-top: -20px; | ||
| margin-left: 20px; | ||
| padding: 0.15rem; | ||
| background-color: #578FCA; | ||
| border: 2px solid transparent; /* Always has same thickness */ | ||
| border-radius: 0.5rem; | ||
| cursor: pointer; | ||
| transition: border-color 0.2s ease; | ||
| box-sizing: border-box; /* Ensures borders don’t change size */ | ||
| } | ||
|
|
||
| .button-open { | ||
| border-color: #578FCA; /* Only the color changes */ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import "./DropdownButton.css" | ||
| // import {FaChevronDown} from "react-icons/fa" | ||
|
|
||
| const DropdownButton = ({children, open, toggle}) => { | ||
| return ( | ||
| <div onClick={toggle} | ||
| className={`dropdownbtn ${open ? | ||
| "button-open":null}`} | ||
| > | ||
|
|
||
| {children} | ||
| <span className="toggle-icon"> | ||
| {/* <FaChevronDown /> */} | ||
| </span> | ||
| </div> | ||
| ) | ||
|
|
||
| }; | ||
|
|
||
| export default DropdownButton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| .dropdown-content { | ||
| position: fixed; | ||
| top: 55px; | ||
| left: 10px; | ||
| z-index: 500; | ||
| width: 220px; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| padding-top: 1rem; | ||
| margin-top: 0.5rem; | ||
| background-color: #124170; | ||
| border-radius: 0.5rem; | ||
| border: 1px solid #578FCA; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); | ||
| max-height: 40vh; | ||
| overflow-y: scroll; | ||
| scrollbar-width: none; | ||
| -ms-overflow-style: none; | ||
|
|
||
| /* Hidden by default */ | ||
| opacity: 0; | ||
| visibility: hidden; | ||
| transform: translateY(-10px); | ||
| transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .dropdown-content::-webkit-scrollbar { | ||
| width: 0; | ||
| height: 0; | ||
| } | ||
|
|
||
| .content-open { | ||
| opacity: 1; | ||
| visibility: visible; | ||
| transform: translateY(0); | ||
| pointer-events: auto; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import React from "react"; | ||
| import "./DropdownContent.css"; | ||
|
|
||
| const DropdownContent = ({ children, open }) => { | ||
| return ( | ||
| <div className={`dropdown-content ${open ? "content-open" : ""}`}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default DropdownContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .dropdown-item { | ||
| /* padding: 0.5rem; */ | ||
| /* margin:0.1rem; */ | ||
| padding-top:28px; | ||
| width:100%; | ||
| border-radius:0.5rem; | ||
| cursor:pointer; | ||
|
|
||
| } | ||
| /* .dropdown-item:hover { | ||
| background-color: rgba(87, 143, 202, 0.3); /* Semi-transparent blue */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import React from "react"; | ||
| import "./DropdownItem.css" | ||
|
|
||
| const DropdownItem = ({ children, onClick }) => { | ||
| return ( | ||
| <div className="dropdown-item" onClick = | ||
| {onClick}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default DropdownItem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { useState, useEffect, useLayoutEffect } from 'react'; | ||
| import '../styles/LoopToggle.css'; | ||
| import scheduleData from '../data/schedule.json'; | ||
| import routeData from '../data/routes.json'; | ||
| import { aggregatedSchedule } from '../data/parseSchedule'; | ||
| import "../styles/LoopToggle.css"; | ||
| export default function LoopToggle() { | ||
|
|
||
| const [active, setActive] = useState("north"); | ||
| return( | ||
| <div class="toggle-div"> | ||
| <button | ||
| className={active ==="north" ? "north-on" : "north-off"} | ||
| onClick={() => setActive("north")} | ||
| > | ||
| North | ||
| </button> | ||
| <button | ||
| className={active === "west" ? "west-on" : "west-off"} | ||
| onClick={() => setActive("west")} | ||
| > | ||
| West | ||
| </button> | ||
| </div> | ||
| ); | ||
| } |
Empty file.
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove