-
Notifications
You must be signed in to change notification settings - Fork 59
OTP-UI Icons #150
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
Merged
Merged
OTP-UI Icons #150
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5cf0d59
Merge branch 'dev' into otp-ui-icons + typo fix
binh-dam-ibigroup 2d81d30
refactor(line-itin/itinerary.css): Remove unused file from before merge.
binh-dam-ibigroup 16dcedf
fix(lib/index): Should not have removed LineItinerary from lib/index.
binh-dam-ibigroup f4526d9
Merge branch 'dev' into otp-ui-icons
binh-dam-ibigroup 4aeb823
refactor(print-layout): Extract LegIcon (and ModeIcon) props to examp…
binh-dam-ibigroup e21ccfa
refactor(LineItinerary): Extract and propagate LegIcon prop from Line…
binh-dam-ibigroup f6f9d7c
refactor(line-itin): Extract LegIcon prop from line-itin/ItinerarySum…
binh-dam-ibigroup ac0d817
refactor(mobile): Extract and propagate LegIcon prop to MobileMain sc…
binh-dam-ibigroup 8de95a1
refactor(default-itinerary): Extract LegIcon prop from DefaultItineary.
binh-dam-ibigroup 7512b6e
refactor(SettingsSelectorPanel): Extract and propagate ModeIcon prop …
binh-dam-ibigroup 9a70180
refactor: Remove old customIcons and icons props.
binh-dam-ibigroup 685a484
docs(example.js): Add a note for testing.
binh-dam-ibigroup 02fef27
refactor(ModeIcon prop): Make ModeIcon prop required.
binh-dam-ibigroup 94982a1
fix(example): Fix syntax error
binh-dam-ibigroup 2842fdc
style: Change style and add comment per PR feedback.
binh-dam-ibigroup 9219719
refactor(package): Upgrade @opentripplanner packages. Update example.…
binh-dam-ibigroup ac4d6db
refactor(icons): move example custom icons into own file
landonreed 4206465
docs(example): Remove a dummy custom icon example in favor for the ot…
binh-dam-ibigroup 266ecb4
refactor(example): set useCustomIcons to false
landonreed 538bf69
Merge branch 'otp-ui-icons' into otp-ui-icons-ltr
landonreed ca27560
Merge pull request #164 from opentripplanner/otp-ui-icons-ltr
binh-dam-ibigroup 404f941
fix(css): Match date and mode selector styles to trimet-mod-otp
binh-dam-ibigroup 5673af5
Merge branch 'otp-ui-icons' of https://github.com/opentripplanner/otp…
binh-dam-ibigroup bc67a45
fix(margins): Fix trip form margins
binh-dam-ibigroup e0373e8
style(results-screen): Reorder vars in render()
binh-dam-ibigroup 6c10ea6
fix(css): Match trimet style for TripDetails, itinerary footer, Place…
binh-dam-ibigroup 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 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,47 @@ | ||
| import { | ||
| ClassicBus, | ||
| ClassicGondola, | ||
| ClassicModeIcon, | ||
| Ferry, | ||
| LegIcon, | ||
| StandardGondola | ||
| } from '@opentripplanner/icons' | ||
|
|
||
| /** | ||
| * For more advanced users, you can replicate and customize components and | ||
| * observe the change in icons. | ||
| * - For LegIcon: https://github.com/opentripplanner/otp-ui/blob/master/packages/icons/src/trimet-leg-icon.js | ||
| * - For ModeIcon: https://github.com/opentripplanner/otp-ui/blob/master/packages/icons/src/trimet-mode-icon.js | ||
| * The example below shuffles some icons around from what you might normally | ||
| * expect for demonstration purposes. | ||
| */ | ||
|
|
||
| const CustomTransitIcon = Ferry | ||
| const CustomRailIcon = ClassicGondola | ||
| const CustomStreetcarIcon = StandardGondola | ||
| const CustomBikeRentalIcon = ClassicBus | ||
|
|
||
| export const CustomModeIcon = ({ mode, ...props }) => { | ||
| if (!mode) return null | ||
| switch (mode.toLowerCase()) { | ||
| // Place custom icons for each mode here. | ||
| case 'transit': | ||
| return <CustomTransitIcon {...props} /> | ||
| case 'rail': | ||
| return <CustomRailIcon {...props} /> | ||
| default: | ||
| return <ClassicModeIcon mode={mode} {...props} /> | ||
| } | ||
| } | ||
|
|
||
| export const CustomLegIcon = ({ leg, ...props }) => { | ||
| if ( | ||
| leg.routeLongName && | ||
| leg.routeLongName.startsWith('MAX') | ||
| ) { | ||
| return <CustomStreetcarIcon /> | ||
| } else if (leg.rentedBike) { | ||
| return <CustomBikeRentalIcon /> | ||
| } | ||
| return <LegIcon leg={leg} ModeIcon={CustomModeIcon} {...props} /> | ||
| } |
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.