Compare commits
No commits in common. "84f369f4c685ccc09ae61dc678fce4d62c472d25" and "8ebb55e31a4e2767684b7f2c1f1ef1605b686c91" have entirely different histories.
84f369f4c6
...
8ebb55e31a
11 changed files with 21 additions and 87 deletions
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: var(--color-primary);
|
background-color: #f5f5f5;
|
||||||
font-family: var(--font-body), serif;
|
font-family: var(--font-body), serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
:root {
|
:root {
|
||||||
--color-primary: #f5f5f5;
|
--color-primary: #000;
|
||||||
--color-surface: #fff;
|
--color-surface: #fff;
|
||||||
--font-body: 'Ubuntu', serif;
|
--font-body: 'Ubuntu', serif;
|
||||||
--result-background: #c4c1d2;
|
|
||||||
--panel-background: #f5f5f5;
|
|
||||||
--card-background: #c4c1d2;
|
|
||||||
--color-action-button: #4caf50;
|
|
||||||
--color-action-button-text: #fff;
|
|
||||||
--color-error-text: red;
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<script lang="ts" setup>
|
|
||||||
defineProps<{
|
|
||||||
buttonText: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits(['action'])
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<button @click="emit('action')">{{ buttonText }}</button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
button {
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 0.25rem;
|
|
||||||
background-color: var(--color-action-button);
|
|
||||||
color: var(--color-action-button-text);
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.card {
|
.card {
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
background-color: var(--card-background);
|
background-color: lightgray;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ defineProps<{
|
||||||
placeholder: string
|
placeholder: string
|
||||||
buttonText: string
|
buttonText: string
|
||||||
inputName: string
|
inputName: string
|
||||||
inputId?: string
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits(['action'])
|
const emit = defineEmits(['action'])
|
||||||
|
|
@ -14,8 +13,7 @@ const emit = defineEmits(['action'])
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input :id="inputId"
|
<input v-model="model"
|
||||||
v-model="model"
|
|
||||||
:name="inputName"
|
:name="inputName"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
type="text">
|
type="text">
|
||||||
|
|
@ -26,8 +24,8 @@ const emit = defineEmits(['action'])
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
button {
|
button {
|
||||||
background-color: var(--color-action-button);
|
background-color: #4caf50;
|
||||||
color: var(--color-action-button-text, white);
|
color: white;
|
||||||
padding: .5rem 1rem;
|
padding: .5rem 1rem;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0 4px 4px 0;
|
border-radius: 0 4px 4px 0;
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,6 @@ const handleLogin = async () => {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: var(--color-error-text, red);
|
|
||||||
}
|
|
||||||
|
|
||||||
.password-form {
|
.password-form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ form {
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: var(--color-error-text, red);
|
color: red;
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -60,7 +60,7 @@ const handleRegistration = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
color: var(--color-error-text, red);
|
color: red;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ dt {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
|
justify-content: center;
|
||||||
max-width: 40rem;
|
max-width: 40rem;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
import type {MovieSearchResult} from "~/types/movie-search-results";
|
import type {MovieSearchResult} from "~/types/movie-search-results";
|
||||||
import type {MovieList} from "~/types/movie-list";
|
import type {MovieList} from "~/types/movie-list";
|
||||||
import type {ResourceResponse} from "@/types/api";
|
import type {ResourceResponse} from "@/types/api";
|
||||||
import InputAction from "~/components/common/input-action.vue";
|
|
||||||
import ButtonAction from "~/components/common/button-action.vue";
|
|
||||||
|
|
||||||
const emit = defineEmits(['add-movie']);
|
const emit = defineEmits(['add-movie']);
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -11,18 +9,15 @@ const props = defineProps<{
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const searchQuery = ref("");
|
const searchQuery = ref("");
|
||||||
const errorMessage = ref("");
|
|
||||||
|
|
||||||
const movies = ref<MovieSearchResult[]>([]);
|
const movies = ref<MovieSearchResult[]>([]);
|
||||||
const searchMovies = () => {
|
const searchMovies = () => {
|
||||||
$api<ResourceResponse<MovieSearchResult[]>>(`/api/movies/search/${searchQuery.value}`, {
|
$api<ResourceResponse<MovieSearchResult[]>>(`/api/movies/search/${searchQuery.value}`, {
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
errorMessage.value = "";
|
|
||||||
movies.value = response.data
|
movies.value = response.data
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
if (error.response.status === 404)
|
alert(error.message)
|
||||||
errorMessage.value = "No movies found"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,27 +37,23 @@ const addMovieToList = (movie: MovieSearchResult) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="content">
|
<div>
|
||||||
<h2>Movie Search</h2>
|
<h2>Movie Search</h2>
|
||||||
<form @submit.prevent="searchMovies">
|
<form @submit.prevent="searchMovies">
|
||||||
<label for="search">Search Movies</label>
|
<label for="search">Search Movies</label>
|
||||||
<InputAction
|
|
||||||
v-model="searchQuery"
|
<div>
|
||||||
button-text="Search"
|
<input id="search" v-model="searchQuery" type="text"/>
|
||||||
input-id="search"
|
<button>Search</button>
|
||||||
input-name="search"
|
</div>
|
||||||
placeholder="Enter a movie title"
|
|
||||||
@action="searchMovies"
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
<p v-if="errorMessage" class="error-message">{{ errorMessage }}</p>
|
<ul class="results-list">
|
||||||
<ul v-else class="results-list">
|
|
||||||
<li v-for="movie in movies" :key="movie.imdbId" class="movie-result">
|
<li v-for="movie in movies" :key="movie.imdbId" class="movie-result">
|
||||||
<img :src="movie.poster" alt="movie poster">
|
<img :src="movie.poster" alt="movie poster">
|
||||||
<div class="movie-details">
|
<div class="movie-details">
|
||||||
<span>{{ movie.title }}</span>
|
<span>{{ movie.title }}</span>
|
||||||
<span>{{ movie.year }}</span>
|
<span>{{ movie.year }}</span>
|
||||||
<ButtonAction button-text="Add Movie" @action="addMovieToList(movie)"/>
|
<button @click="addMovieToList(movie)">Add Movie</button>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -72,22 +63,6 @@ const addMovieToList = (movie: MovieSearchResult) => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
h2 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
margin-bottom: 0.5em;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: var(--color-error-text, red);
|
|
||||||
text-align: center;
|
|
||||||
margin: 5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.results-list {
|
.results-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -108,12 +83,9 @@ label {
|
||||||
.movie-result {
|
.movie-result {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
border: 1px solid black;
|
||||||
box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.1);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 0.3rem;
|
|
||||||
background-color: var(--result-background);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.movie-result img {
|
.movie-result img {
|
||||||
|
|
@ -121,9 +93,4 @@ label {
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -37,11 +37,11 @@ const emit = defineEmits<{
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
background: var(--panel-background, #fff);
|
background: var(--color-surface, #fff);
|
||||||
z-index: 101;
|
z-index: 101;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
padding: 1rem;
|
||||||
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
|
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
|
||||||
padding: 3rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-button {
|
.close-button {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue