-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from OneBusAway/feat-search
Search Feature [In-Progress]
- Loading branch information
Showing
11 changed files
with
274 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"command": "npm run dev", | ||
"name": "Run development server", | ||
"request": "launch", | ||
"type": "node-terminal" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
.scroll-hidden { | ||
-ms-overflow-style: none; /* Internet Explorer 10+ */ | ||
scrollbar-width: none; /* Firefox */ | ||
} | ||
.scroll-hidden::-webkit-scrollbar { | ||
display: none; /* Safari and Chrome */ | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,55 @@ | ||
<script> | ||
export let searchResults = null; | ||
import { createEventDispatcher } from 'svelte'; | ||
import { compassDirection } from '$lib/formatters'; | ||
const dispatch = createEventDispatcher(); | ||
function handleStopClick(stop) { | ||
dispatch('stopSelected', { stop }); | ||
} | ||
function handleRouteClick(route) { | ||
alert(`TODO: show route ${route.id}`); | ||
} | ||
</script> | ||
|
||
<div class="p-2"> | ||
<h2 class="mb-4 text-xl font-semibold uppercase text-[#86858B]">Search Results</h2> | ||
|
||
<h3 class="mb-2 text-lg font-semibold dark:text-white">Routes</h3> | ||
{#if searchResults?.routeSearchResults?.list?.length > 0} | ||
<ul class="overflow-hidden rounded-lg"> | ||
{#each searchResults.routeSearchResults.list as route} | ||
<li> | ||
<button | ||
on:click={() => handleRouteClick(route)} | ||
class="flex h-auto w-full items-center justify-between border-b-[1px] border-[#C6C6C8] bg-[#ffffff] p-4 hover:cursor-pointer hover:bg-[#e3e3e3] dark:border-[#313135] dark:bg-[#1c1c1c] dark:text-white hover:dark:bg-[#363636]" | ||
> | ||
{route.name || `Route ${route.id}`} | ||
</button> | ||
</li> | ||
{/each} | ||
</ul> | ||
{:else} | ||
<p>No routes found.</p> | ||
{/if} | ||
|
||
<h3 class="mb-2 mt-4 text-lg font-semibold dark:text-white">Stops</h3> | ||
{#if searchResults?.stopSearchResults?.list?.length > 0} | ||
<ul class="overflow-hidden rounded-lg"> | ||
{#each searchResults.stopSearchResults.list as stop} | ||
<li> | ||
<button | ||
on:click={() => handleStopClick(stop)} | ||
class="flex h-auto w-full items-center justify-between border-b-[1px] border-[#C6C6C8] bg-[#ffffff] p-4 hover:cursor-pointer hover:bg-[#e3e3e3] dark:border-[#313135] dark:bg-[#1c1c1c] dark:text-white hover:dark:bg-[#363636]" | ||
> | ||
{stop.name} ({compassDirection(stop.direction)}) | ||
</button> | ||
</li> | ||
{/each} | ||
</ul> | ||
{:else} | ||
<p>No stops found.</p> | ||
{/if} | ||
</div> |
This file contains 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,22 @@ | ||
export function compassDirection(abbreviation) { | ||
switch (abbreviation) { | ||
case 'N': | ||
return 'North'; | ||
case 'NE': | ||
return 'Northeast'; | ||
case 'E': | ||
return 'East'; | ||
case 'SE': | ||
return 'Southeast'; | ||
case 'S': | ||
return 'South'; | ||
case 'SW': | ||
return 'Southwest'; | ||
case 'W': | ||
return 'West'; | ||
case 'NW': | ||
return 'Northwest'; | ||
default: | ||
return abbreviation; | ||
} | ||
} |
This file contains 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
Oops, something went wrong.