Skip to content

Commit

Permalink
Add image to BarItem
Browse files Browse the repository at this point in the history
  • Loading branch information
SchutteJan committed Sep 20, 2023
1 parent f025ad2 commit a0b6493
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
32 changes: 24 additions & 8 deletions frontend/src/lib/BarItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@
import type { LocationResponse } from '../models/schemas';
export let bar: LocationResponse;
const placeholder =
'https://images.jan.tf/ecmAqc89DiQEu0HlPMBcNxDFyigWMJI-xUJCNJAbklQ/fill/512/512/no/1/bG9jYWw6Ly8vYmFyLXBsYWNlaG9sZGVyLnBuZw.jpg';
</script>

<div>
<b>Name:</b>
{bar.name} <br />
<b>Description:</b>
{bar.description ?? 'No Description'} <br />
<b>Coords:</b>
x: {bar.coordinates.x}, y: {bar.coordinates.y}
</div>
<article class="bar-item">
<div class="bar-image" style="background-image: url({bar.imageurl ?? placeholder})" />
<div>
<h2>{bar.name}</h2>
<p>{bar.description ?? 'No Description'}</p>
<small>x:{bar.coordinates.x}, y: {bar.coordinates.y} </small>
</div>
</article>

<style>
.bar-item {
display: flex;
}
.bar-item > .bar-image {
width: 10rem;
height: 10rem;
background-size: cover;
background-position: center;
margin: 0 var(--pico-block-spacing-horizontal);
border-radius: var(--pico-border-radius);
}
</style>
3 changes: 3 additions & 0 deletions frontend/src/lib/pico-settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:root {
--pico-spacing: 0.5rem;
}
1 change: 1 addition & 0 deletions frontend/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import '@picocss/pico';
import '$lib/pico-settings.css';
</script>

<slot />

0 comments on commit a0b6493

Please sign in to comment.