Skip to content

Commit

Permalink
game card component background colors & spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonWingerAir committed Jan 20, 2024
1 parent badfdd3 commit 56b0233
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 3 additions & 3 deletions components/GameCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="h-full w-64 border flex flex-col text-white text-center justify-end bg-neutral-600">
<div class="h-full mb-5 bg-transparent hover:bg-gray-200 flex justify-center">
<div class="h-full w-64 border flex flex-col text-center justify-end bg-neutral-300">
<div class="h-full bg-transparent hover:bg-gray-200 flex justify-center">
<div class="flex">
<img
:src="imgPath"
Expand All @@ -9,7 +9,7 @@
/>
</div>
</div>
<div class="text-lg pb-3">
<div class="text-lg bg-white py-4">
<p>{{ game?.name }}</p>
</div>
<!-- <p class="text-m text-gray-500 break-words text-wrap truncate overflow-hidden px-2">
Expand Down
2 changes: 1 addition & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div class="bg-white text-center py-7 border-t-4 border-t-red-600 border-b-2 md:border-b-4 border-b-neutral-900">
<h2 class="mb-5">
Built with Nuxt 3 by <a href="https://www.brandonwinger-air.com" target="_blank" class="font-semibold">Brandon Winger-Air</a> using <a href="https://www.giantbomb.com/api/" target="_blank" class="font-semibold">external API</a>.
A study project built with Nuxt 3 by <a href="https://www.brandonwinger-air.com" target="_blank" class="font-semibold">Brandon Winger-Air</a> using an <a href="https://www.giantbomb.com/api/" target="_blank" class="font-semibold">external API</a>.
</h2>

<hr width="325" class="mx-auto mb-4">
Expand Down
24 changes: 24 additions & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
<div v-for="game in data?.results">
<GameCard :game="game"></GameCard>
</div>

<!-- TODO: Requires custom results pagination -->
<!-- <div v-if="data?.results.length" class="flex justify-center"> -->
<!-- <button v-if="!disablePrevious" @click="page--" class="px-4 py-2 text-m border rounded-lg">
Prev
</button>
<div class="px-4 py-2 text-m border rounded-lg">
</div>
<button v-if="!disableNext" @click="page++" class="px-4 py-2 text-m border rounded-lg">
Next
</button> -->
<!-- </div> -->
</div>
<div v-else class="mb-10 text-center">
<div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-x-10 gap-y-10 mb-10">
Expand All @@ -62,6 +75,17 @@ import type { Response } from '~/types/Response';
const searchTerm = ref('');
// TODO: Requires custom results pagination
// const page = ref(1);
// const disabledPrevious = computed(() => {
// return page.value === 1;
// });
// const disableNext = computed(() => {
// return page.value + 1 === data.value?.total_pages;
// });
const debouncedSearchTerm = refDebounced(searchTerm, 300);
const url = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion server/api/games/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default defineEventHandler((event) => {
const {query} = getQuery(event);
const config = useRuntimeConfig();

return $fetch(`${config.apiBaseUrl}/search/?api_key=${config.apiKey}&query=${query}&format=json`);
return $fetch(`${config.apiBaseUrl}/search/?api_key=${config.apiKey}&query=${query}&format=json&limit=20`);
});

0 comments on commit 56b0233

Please sign in to comment.