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 type { Actions, PageServerLoad } from '../$types';
|
||||||
import { Games } from '$root/search/actions';
|
import { Games } from '$root/search/actions';
|
||||||
|
|
||||||
export const load: PageServerLoad = ({ request }) => {
|
export const load: PageServerLoad = (v) => {
|
||||||
console.log('page server load request', request)
|
console.log('page server load request', v)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
games: [],
|
games: [],
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,11 @@
|
||||||
gameStore.addAll(data?.games);
|
gameStore.addAll(data?.games);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: if (form?.games) {
|
||||||
|
gameStore.removeAll();
|
||||||
|
gameStore.addAll(form?.games);
|
||||||
|
}
|
||||||
|
|
||||||
interface RemoveGameEvent extends Event {
|
interface RemoveGameEvent extends Event {
|
||||||
detail: GameType | SavedGameType;
|
detail: GameType | SavedGameType;
|
||||||
}
|
}
|
||||||
|
|
@ -43,3 +48,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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));
|
games.push(mapAPIGameToBoredGame(game));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('returning from search')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
games,
|
games,
|
||||||
totalCount: games.length
|
totalCount: games.length
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue