-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Migrates the Place Photos sample. #1064
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
base: main
Are you sure you want to change the base?
Conversation
|
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
| let heading = document.getElementById('heading') as HTMLElement; | ||
| let summary = document.getElementById('summary') as HTMLElement; | ||
| let gallery = document.getElementById('gallery') as HTMLElement; | ||
| let expandedImageDiv = document.getElementById( |
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.
These can be chagned to const
| let heading = document.getElementById('heading') as HTMLElement; | |
| let summary = document.getElementById('summary') as HTMLElement; | |
| let gallery = document.getElementById('gallery') as HTMLElement; | |
| let expandedImageDiv = document.getElementById( | |
| const heading = document.getElementById('heading') as HTMLElement; | |
| const summary = document.getElementById('summary') as HTMLElement; | |
| const gallery = document.getElementById('gallery') as HTMLElement; | |
| const expandedImageDiv = document.getElementById( |
| let expandedImageDiv = document.getElementById( | ||
| 'expanded-image' | ||
| ) as HTMLElement; | ||
| let attributionLabel; |
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.
This can be removed and declared inside each block that needs an attributionLabel
| expandedImage.alt = altText; | ||
| expandedImageDiv.innerHTML = ''; | ||
| expandedImageDiv.appendChild(expandedImage); | ||
| attributionLabel = createAttribution(photo.authorAttributions); |
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.
| attributionLabel = createAttribution(photo.authorAttributions); | |
| const attributionLabel = createAttribution(photo.authorAttributions); |
| img.alt = 'Photo of ' + place.displayName; | ||
| img.src = place.photos![0].getURI(); | ||
| expandedImageDiv.appendChild(img); | ||
| attributionLabel = createAttribution(place.photos![0].authorAttributions); |
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.
| attributionLabel = createAttribution(place.photos![0].authorAttributions); | |
| const attributionLabel = createAttribution(place.photos![0].authorAttributions); |
| } | ||
|
|
||
| // Helper function to create attribution DIV. | ||
| function createAttribution(attribution) { |
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.
Add a type for attribution? Also suggest renaming the parameter to attributions since multiple are passed.
| function createAttribution(attribution) { | |
| function createAttribution(attributions: google.maps.places.AuthorAttribution[]) { |
| if (attribution && attribution[0]) { | ||
| attributionLabel.textContent = attribution[0].displayName; | ||
| attributionLabel.href = attribution[0].uri; |
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.
| if (attribution && attribution[0]) { | |
| attributionLabel.textContent = attribution[0].displayName; | |
| attributionLabel.href = attribution[0].uri; | |
| if (attributions && attributions[0]) { | |
| attributionLabel.textContent = attributions[0].displayName; | |
| attributionLabel.href = attributions[0].uri; |
This PR does the following things: