diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index cb04852..83fc821 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,10 +1,12 @@ ## Checklist ### Required changes: -- [ ] Center the description (Line 17 in HTML file) using a single change in CSS -- [ ] Fix JS so that when the search is executed, the search engine is not present in query -- [ ] Add Google Drive, Google Slides and Google Sheets as a provider + +- [x] Center the description (Line 17 in HTML file) using a single change in CSS +- [x] Fix JS so that when the search is executed, the search engine is not present in query +- [x] Add Google Drive, Google Slides and Google Sheets as a provider ### Optional changes: -- [ ] Add other search providers (GitHub, Spotify, etc) -- [ ] Additional CSS styling (as you like) \ No newline at end of file + +- [x] Add other search providers (GitHub, Spotify, etc) +- [ ] Additional CSS styling (as you like) diff --git a/google-drive.png b/google-drive.png new file mode 100644 index 0000000..4125cb0 Binary files /dev/null and b/google-drive.png differ diff --git a/google-sheets.png b/google-sheets.png new file mode 100644 index 0000000..e8b6cb3 Binary files /dev/null and b/google-sheets.png differ diff --git a/google-slides.png b/google-slides.png new file mode 100644 index 0000000..a102fb8 Binary files /dev/null and b/google-slides.png differ diff --git a/index.css b/index.css index 09dae3a..619afa2 100644 --- a/index.css +++ b/index.css @@ -16,6 +16,7 @@ body { flex-direction: column; max-width: min(100vw, 80rem); /* Hint */ + align-items: center; } .container > * { margin: 0.5rem; diff --git a/index.js b/index.js index ba99abc..ab36e6e 100644 --- a/index.js +++ b/index.js @@ -2,11 +2,16 @@ let current_search = 'google' document.querySelector('.search_input').addEventListener('keyup', e => { const input = e.target.value; let search_engine = input.split(' ')[0].toLowerCase(); - let search_query = input.split(' ').splice(0).join(' '); + let search_query = input.split(' ').splice(1).join(' '); switch(search_engine){ case 'google': case 'youtube': - case 'docs': break; + case 'docs': + case 'sheets': + case 'drive': + case 'slides': + case 'spotify': + break; default: search_engine = 'google'; search_query = input; } @@ -26,6 +31,22 @@ document.querySelector('.search_input').addEventListener('keyup', e => { image.src = 'docs.png'; image.alt = 'Google Docs icon'; break; + case 'sheets': + image.src = 'google-sheets.png'; + image.alt = 'Google sheets icon'; + break; + case 'drive': + image.src = 'google-drive.png'; + image.alt = 'Google Drive icon'; + break; + case 'slides': + image.src = 'google-slides.png'; + image.alt = 'Google Slides icon'; + break; + case 'spotify': + image.src = 'spotify.png'; + image.alt = 'Spotify icon'; + break; } } if(e.key === 'Enter') @@ -36,6 +57,18 @@ document.querySelector('.search_input').addEventListener('keyup', e => { case 'youtube': window.location = `https://www.youtube.com/results?search_query=${search_query}`; break; + case 'sheets': + window.location = `https://docs.google.com/spreadsheets/?q=${search_query}`; + break; + case 'drive': + window.location = `https://drive.google.com/drive/search?q=${search_query}`; + break; + case 'slides': + window.location = `https://docs.google.com/presentation/?q=${search_query}`; + break; + case 'spotify': + window.location = `https://open.spotify.com/search/${search_query}`; + break; default: window.location = `https://www.google.com/search?q=${search_query}`; } diff --git a/spotify.png b/spotify.png new file mode 100644 index 0000000..259df1e Binary files /dev/null and b/spotify.png differ