nss-evening-cohort-10 / chatty-group-project-tomato-frogs

chatty-group-project-tomato-frogs created by GitHub Classroom
1 stars 2 forks source link

Gif Selector #12

Open zoeames opened 4 years ago

zoeames commented 4 years ago

Giphy Api: Go to https://developers.giphy.com/ and set yourself up with a login and create an app (you can enter whatever information in those fields). You will be using the Search endpoint.

gseals commented 4 years ago

https://medium.com/@mattcroak718/beginners-guide-to-the-giphy-api-316f98459d06

https://gist.github.com/nealrs/28dbfe2c74dfdde26a30

gseals commented 4 years ago

https://www.youtube.com/watch?v=HRh6zHRwRLo (this gets complicated) https://www.youtube.com/watch?v=pfdP26jPvEk (yeah. this video is the one) https://developers.giphy.com/docs/resource#code-examples

gseals commented 4 years ago

this div and button hold everything:

            <div class="deleteThis">
            <input id="searchText" type="text" placeholder="Search...">
            <button class="btn-outline-primary" id="searchgifs" type="submit">Go</button>
            <div id="inner"></div>
            </div>
gseals commented 4 years ago

import $ from 'jquery'; import utilities from '../../helpers/utilities';

const gifMaker = () => { $('#searchgifs').on('click', () => { const xhr = $.get('http://api.giphy.com/v1/gifs/search?q=ryan+gosling&api_key=VaVkZ691aDNtSCDJLLbsiKDDNQlgWwFG&limit=5'); xhr.done((response) => { console.error('success got data', response); const jiffs = response.data; console.log(Object.values(jiffs)); const arrays = Object.values(jiffs); arrays.forEach((array) => { utilities.printToDom('inner', <img src='${array.images.original.url}'></img>); }); }); }); };

// $('#inner').append(''); // $('#inner').append('');

export default { gifMaker };