|
|
@@ -2,7 +2,128 @@
|
|
|
let {data} = $props();
|
|
|
</script>
|
|
|
|
|
|
-<div>
|
|
|
- <a href="/recipe/new">New Recipe</a>
|
|
|
- <h1>Recipes</h1>
|
|
|
+<div class="container">
|
|
|
+ <div class="topbar">
|
|
|
+ <h1>Recipes</h1>
|
|
|
+ <a href="/recipe/new" class="button">New Recipe</a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="recipes">
|
|
|
+ {#each data.recipes as r}
|
|
|
+ <article class="recipe">
|
|
|
+ <p class="name">{r.name}</p>
|
|
|
+ <p class="date">{r.updatedAt ? new Date(r.updatedAt).toLocaleDateString() : ""}</p>
|
|
|
+ </article>
|
|
|
+ {:else}
|
|
|
+ <p class="empty">No recipes yet. Create your first one.</p>
|
|
|
+ {/each}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .container{
|
|
|
+ width: min(720px, 100%);
|
|
|
+ min-height: calc(100% - 75px);
|
|
|
+ min-height: calc(100dvh - 75px);
|
|
|
+ margin: 0 auto;
|
|
|
+ padding: 1rem max(0.75rem, env(safe-area-inset-right, 0px)) max(2rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
|
|
|
+ color: var(--color-text);
|
|
|
+ overflow-x: clip;
|
|
|
+ }
|
|
|
+
|
|
|
+ .topbar{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 0.75rem 1rem;
|
|
|
+ margin-bottom: 1.25rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ h1{
|
|
|
+ font-size: clamp(1.35rem, 1rem + 1.6vw, 1.75rem);
|
|
|
+ font-weight: 700;
|
|
|
+ line-height: 1.2;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .button{
|
|
|
+ margin: 0;
|
|
|
+ flex-shrink: 0;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .recipes{
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 0.5rem;
|
|
|
+ }
|
|
|
+
|
|
|
+ .recipe{
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: baseline;
|
|
|
+ justify-content: space-between;
|
|
|
+ gap: 0.75rem 1.5rem;
|
|
|
+ min-width: 0;
|
|
|
+ padding: 0.85rem 1rem;
|
|
|
+ background: var(--color-surface);
|
|
|
+ border: 1px solid var(--color-border);
|
|
|
+ border-left: 3px solid var(--color-primary);
|
|
|
+ border-radius: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .name{
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ font-size: 1.05rem;
|
|
|
+ font-weight: 600;
|
|
|
+ line-height: 1.35;
|
|
|
+ overflow-wrap: anywhere;
|
|
|
+ }
|
|
|
+
|
|
|
+ .date{
|
|
|
+ flex-shrink: 0;
|
|
|
+ color: var(--color-text-muted);
|
|
|
+ font-size: 0.85rem;
|
|
|
+ line-height: 1.3;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+
|
|
|
+ .date:empty{
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .empty{
|
|
|
+ margin: 0;
|
|
|
+ padding: 2.5rem 1.25rem;
|
|
|
+ text-align: center;
|
|
|
+ color: var(--color-text-muted);
|
|
|
+ background: var(--color-surface);
|
|
|
+ border: 1px dashed var(--color-border);
|
|
|
+ border-radius: 10px;
|
|
|
+ font-size: 0.95rem;
|
|
|
+ line-height: 1.45;
|
|
|
+ }
|
|
|
+
|
|
|
+ @media (min-width: 560px){
|
|
|
+ .container{
|
|
|
+ padding: 1.5rem 1rem 3rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @media (min-width: 900px){
|
|
|
+ .container{
|
|
|
+ padding-top: 2rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @media (pointer: coarse){
|
|
|
+ .button{
|
|
|
+ min-height: 44px;
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|