Created
December 14, 2016 17:17
-
-
Save lyzs90/998584993395fbb23dd43c061caa0b22 to your computer and use it in GitHub Desktop.
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
// Helper function to create carousels | |
let createDeck = (session, tmpDeck, arr, numCards) => { | |
arr.slice(0, numCards).forEach((result) => { | |
let tmpCard = [ | |
new builder.HeroCard(session) | |
.title(result.properties.name[0].text) | |
.subtitle(`${result.properties.category[0].text}, ${result.properties.rating[0].text} stars, ${result.properties.review[0].text}`) | |
.images([ | |
builder.CardImage.create(session, result.properties.image[0].src) | |
.tap(builder.CardAction.showImage(session, result.properties.image[0].src)) | |
]) | |
.buttons([ | |
builder.CardAction.openUrl(session, result.properties.name[0].href, 'Reviews'), | |
builder.CardAction.openUrl(session, `https://www.google.com.sg/maps/dir/${session.userData.location.latitude},${session.userData.location.longitude}/${result.geometry.coordinates[1]},${result.geometry.coordinates[0]}`, 'Directions') | |
]) | |
]; | |
tmpDeck.push(...tmpCard); | |
}); | |
return tmpDeck; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment