-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5324247
commit 2ead363
Showing
11 changed files
with
46 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -13,4 +13,4 @@ body { | |
margin: 0 auto; | ||
} | ||
|
||
/* *{outline:1px solid red;} */ | ||
*{outline:1px solid red;} |
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<script setup> | ||
defineProps(['type']) | ||
</script> | ||
<template> | ||
<span class="flex w-full items-center justify-center"><slot></slot> | ||
<span class="flex w-full items-center justify-center"> | ||
{{ type }} | ||
</span> | ||
|
||
</template> |
This file contains 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,5 @@ | ||
<template> | ||
<div class="flex flex-col md:flex-row gap-2 items-center justify-center mb-4 md:flex-wrap"> | ||
<slot></slot> | ||
</div> | ||
</template> |
This file contains 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,5 @@ | ||
<template> | ||
<div class="md:grid md:grid-cols-4 md:gap-4"> | ||
<slot></slot> | ||
</div> | ||
</template> |
This file contains 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,8 @@ | ||
<script setup> | ||
defineProps(['to']) | ||
</script> | ||
<template> | ||
<NuxtLink class="border-2 px-4 py-2 rounded-full text-xl border-none bg-black text-white hover:bg-white hover:text-black" :to="to"> | ||
<slot></slot> | ||
</NuxtLink> | ||
</template> |
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<template> | ||
<button class="flex flex-row border-2 border-black rounded-full px-4 py-2 items-center justify-center h-11 w-[90%] md:w-fit" @click="$emit('click')"><SearchSVG />Search</button> | ||
<button class="flex flex-row gap-2 bg-black text-white rounded-full px-4 py-2 items-center justify-center h-11 w-[90%] md:w-fit hover:bg-white hover:text-black" @click="$emit('click')"><SearchSVG />Search</button> | ||
</template> |
This file contains 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 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<template> | ||
<div class="flex flex-col w-screen items-center mx-4 gap-6"> | ||
<NuxtLink class="border-2 px-4 py-2 rounded-full border-black text-xl hover:border-white hover:bg-black hover:text-white" to="/google">Search Google</NuxtLink> | ||
<NuxtLink class="border-2 px-4 py-2 rounded-full border-black text-xl hover:border-white hover:bg-black hover:text-white" to="/movies">Search Movies</NuxtLink> | ||
<NavLink to="/google">Search Google</NavLink> | ||
<NavLink to="/movies">Search Movies</NavLink> | ||
</div> | ||
|
||
</template> |
This file contains 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 |
---|---|---|
@@ -1,50 +1,41 @@ | ||
<script setup> | ||
import axios from 'axios' | ||
const searchTerm = ref(""); | ||
const keyExists = ref(true); | ||
const apiError = ref(false); | ||
const movies = ref([]) | ||
const ErrorMessage = ref("") | ||
const movieError = ref(false) | ||
const runtimeConfig = useRuntimeConfig() | ||
function handleSearch(n) { | ||
searchTerm.value = n | ||
} | ||
async function searchMovies() { | ||
try { | ||
const response = await axios.get('https://www.omdbapi.com/?apikey=' + runtimeConfig.public.API_KEY + '&s=' + searchTerm.value); | ||
console.log("Success") | ||
console.log(response.data); | ||
movies.value = response.data.Search | ||
keyExists.value = true | ||
if (response.data.Error != null) { | ||
ErrorMessage.value = response.data.Error | ||
movieError.value = response.data.Error | ||
} else { | ||
ErrorMessage.value = null | ||
movieError.value = false | ||
} | ||
} catch (error) { | ||
console.log("I have errored") | ||
ErrorMessage.value = response.data.Error | ||
movieError.value = response.data.Error | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col md:flex-row gap-2 items-center justify-center mb-4"> | ||
|
||
|
||
<MovieInteract> | ||
<SearchInput @input="handleSearch" /> | ||
<SearchButton @click="searchMovies" /> | ||
</MovieInteract> | ||
|
||
<span v-if="keyExists == false">API Key incorrect</span> | ||
|
||
</div> | ||
|
||
<!-- <ErrorMessage v-if="ErrorMessage != null"> | ||
{{ ErrorMessage }} | ||
</ErrorMessage> --> | ||
|
||
<Card v-for="movie in movies" :smalltext="movie.Type" :title="movie.Title" :subtitle="movie.Year" | ||
:image="movie.Poster" /> | ||
<ErrorMessage v-if="movieError" :type="movieError" /> | ||
<ErrorMessage v-if="apiError" :type="apiError" /> | ||
|
||
<MovieResults> | ||
<Card v-for="movie in movies" :smalltext="movie.Type" :title="movie.Title" :subtitle="movie.Year" | ||
:image="movie.Poster" /> | ||
</MovieResults> | ||
</template> |