mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Render games without javascript to the search page.
This commit is contained in:
parent
fa26cbc91e
commit
f4ac64e88e
3 changed files with 33 additions and 2 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import type { Actions, PageServerLoad } from '../$types';
|
||||
import { Games } from '$root/search/actions';
|
||||
|
||||
export const load: PageServerLoad = ({ request }) => {
|
||||
console.log('page server load request', request)
|
||||
export const load: PageServerLoad = (v) => {
|
||||
console.log('page server load request', v)
|
||||
|
||||
return {
|
||||
games: [],
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@
|
|||
gameStore.addAll(data?.games);
|
||||
}
|
||||
|
||||
$: if (form?.games) {
|
||||
gameStore.removeAll();
|
||||
gameStore.addAll(form?.games);
|
||||
}
|
||||
|
||||
interface RemoveGameEvent extends Event {
|
||||
detail: GameType | SavedGameType;
|
||||
}
|
||||
|
|
@ -43,3 +48,27 @@
|
|||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.games {
|
||||
margin: 2rem 0rem;
|
||||
|
||||
h1 {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.games-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(200px, 1fr));
|
||||
gap: 2rem;
|
||||
|
||||
@media (max-width: 800px) {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
@media (max-width: 650px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ export const Games: Actions = {
|
|||
games.push(mapAPIGameToBoredGame(game));
|
||||
});
|
||||
|
||||
console.log('returning from search')
|
||||
|
||||
return {
|
||||
games,
|
||||
totalCount: games.length
|
||||
|
|
|
|||
Loading…
Reference in a new issue