Recipes phase 1
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
(() => {
|
||||
const button = document.querySelector('[data-add-ingredient]');
|
||||
const container = document.querySelector('[data-ingredient-forms]');
|
||||
const template = document.querySelector('#recipe-empty-ingredient');
|
||||
const total = document.querySelector('#id_ingredients-TOTAL_FORMS');
|
||||
if (!button || !container || !template || !total) return;
|
||||
button.addEventListener('click', () => {
|
||||
const index = Number(total.value);
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.innerHTML = template.innerHTML.replaceAll('__prefix__', String(index));
|
||||
const row = wrapper.firstElementChild;
|
||||
if (!row) return;
|
||||
container.appendChild(row);
|
||||
total.value = String(index + 1);
|
||||
row.querySelector('input[name$="-name"]')?.focus();
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
.page-content.recipes-page-content{max-width:1600px;padding:28px clamp(16px,3vw,32px) 72px}
|
||||
.recipes-layout{--recipe-surface:#fff;--recipe-line:#e4e8e2;--recipe-ink:#25292e;--recipe-muted:#687178;--recipe-soft:#f5f7f3;--recipe-accent:#235943;display:grid;grid-template-columns:minmax(260px,340px) minmax(0,1fr) minmax(245px,290px);gap:20px;align-items:start;width:100%;max-width:1600px;margin-inline:auto;color:var(--recipe-ink)}
|
||||
.recipes-layout *{box-sizing:border-box}.recipes-layout a:focus-visible,.recipes-layout button:focus-visible,.recipes-layout input:focus-visible,.recipes-layout select:focus-visible,.recipes-layout textarea:focus-visible,.recipes-layout summary:focus-visible{outline:3px solid #77b68b;outline-offset:3px}
|
||||
.recipes-browser,.recipes-detail,.recipes-info{min-width:0}.recipes-browser__heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:0 0 18px}.recipes-browser__heading h1{margin:0 0 2px;font-size:2.35rem}.recipes-browser__heading p{margin:0;color:var(--recipe-muted);font-size:.85rem}.recipes-new{flex:none;min-height:42px;margin-top:4px;padding-inline:14px;white-space:nowrap}
|
||||
.recipes-filters{display:grid;gap:12px;margin:0 0 16px}.recipes-filters>label:first-child{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.recipes-search-row{display:flex;gap:7px}.recipes-search-row input{flex:1;min-width:0}.recipes-search-row button,.recipes-filter-apply,.recipes-outline-button{min-height:42px;padding:8px 12px;border:1px solid #d7dcd5;border-radius:9px;color:var(--recipe-ink);background:var(--recipe-surface);font-size:.81rem;font-weight:700;text-decoration:none}.recipes-search-row button:hover,.recipes-filter-apply:hover,.recipes-outline-button:hover{border-color:var(--recipe-accent);color:var(--recipe-accent)}.recipes-search-row input,.recipes-filter-grid select{width:100%;min-height:42px;padding:9px 11px;border:1px solid #d7dcd5;border-radius:9px;color:var(--recipe-ink);background:var(--recipe-surface)}.recipes-filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.recipes-filter-grid label{min-width:0;color:var(--recipe-muted);font-size:.75rem;font-weight:700}.recipes-filter-grid select{margin-top:4px}.recipes-favourite-filter{display:flex;align-items:center;gap:7px;color:var(--recipe-ink);font-size:.82rem}.recipes-favourite-filter input{width:17px;height:17px;accent-color:var(--recipe-accent)}.recipes-filter-apply{justify-self:start}
|
||||
.recipes-list{display:grid;gap:8px}.recipes-list-item{display:flex;align-items:center;gap:11px;min-height:86px;padding:9px;border:1px solid var(--recipe-line);border-radius:13px;color:inherit;background:var(--recipe-surface);text-decoration:none}.recipes-list-item:hover,.recipes-list-item--selected{border-color:#69a581;background:#f8fcf8}.recipes-list-item__image,.recipes-list-item__placeholder{flex:none;width:68px;height:68px;border-radius:9px;object-fit:cover}.recipes-list-item__placeholder{display:grid;place-items:center;color:#3f6954;background:#e1eee5;font-family:Fraunces,Georgia,serif;font-size:.72rem;font-weight:700}.recipes-list-item__body{display:grid;gap:1px;min-width:0}.recipes-list-item__body strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:Fraunces,Georgia,serif;font-size:.96rem;line-height:1.2}.recipes-list-item__body small{color:var(--recipe-muted);font-size:.73rem}.recipes-list-item__tags,.recipes-chips{display:flex;flex-wrap:wrap;gap:5px;margin-top:4px}.recipes-list-item__tags span,.recipes-chips span{padding:3px 8px;border-radius:999px;background:#eef1ed;font-size:.7rem}.recipes-list-item__favourite{align-self:flex-start;margin-left:auto;color:#bd4e48;font-size:1rem}.recipes-empty-list{padding:24px;border:1px dashed var(--recipe-line);border-radius:13px;background:var(--recipe-surface)}.recipes-empty-list p{margin:0 0 8px}.recipes-empty-list a{color:var(--recipe-accent)}
|
||||
.recipes-detail{min-height:560px;padding:20px;border:1px solid var(--recipe-line);border-radius:17px;background:var(--recipe-surface);box-shadow:0 12px 35px rgba(29,43,37,.045)}.recipes-detail__top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 17px}.recipes-back{color:var(--recipe-accent);font-size:.8rem;font-weight:700;text-decoration:none}.recipes-back:hover{text-decoration:underline}.recipes-detail__top-actions{display:flex;align-items:center;gap:7px}.recipes-detail__top-actions form{margin:0}.recipes-heart{display:grid;place-items:center;width:42px;height:42px;padding:0;border:0;color:#bd4e48;background:transparent;font-size:1.6rem}.recipes-hero{display:grid;grid-template-columns:minmax(180px,42%) minmax(0,1fr);gap:22px;align-items:start;padding-bottom:21px;border-bottom:1px solid var(--recipe-line)}.recipes-hero>img,.recipes-photo-placeholder{display:block;width:100%;height:220px;border-radius:12px;object-fit:cover}.recipes-photo-placeholder{display:grid;place-items:center;border:1px dashed #acc8b4;color:#466c54;background:#e5f1e8;font-family:Fraunces,Georgia,serif}.recipes-hero__copy{min-width:0}.recipes-eyebrow{margin:0 0 4px;color:var(--recipe-accent);font-size:.7rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase}.recipes-hero h2{margin:0 0 9px;font-size:clamp(1.8rem,2.6vw,2.7rem);line-height:1.12}.recipes-hero__meta{margin:0;color:var(--recipe-muted);font-size:.85rem}.recipes-chips{margin-top:11px}.recipes-chips span{padding:5px 10px;font-size:.73rem}.recipes-hero__description{margin:14px 0 0;color:var(--recipe-muted);font-size:.88rem;line-height:1.6}.recipes-content-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin-top:18px}.recipes-content-stack{display:grid;gap:12px;align-content:start}.recipes-panel{min-width:0;padding:17px;border:1px solid var(--recipe-line);border-radius:13px;background:var(--recipe-surface)}.recipes-panel h3{margin:0 0 13px;font-family:Fraunces,Georgia,serif;font-size:1.05rem}.recipes-ingredient-list{padding:0;margin:0;list-style:none}.recipes-ingredient-list li{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 12px;padding:10px 0;border-bottom:1px solid var(--recipe-line);font-size:.83rem}.recipes-ingredient-list li:last-child{border-bottom:0}.recipes-ingredient-list small{display:block;color:var(--recipe-muted)}.recipes-ingredient-list strong{white-space:nowrap;font-weight:700}.recipes-ingredient-list em{width:100%;color:var(--recipe-muted);font-size:.72rem}.recipes-markdown-source{overflow-wrap:anywhere;font-size:.86rem;line-height:1.65}.recipes-muted{color:var(--recipe-muted);font-size:.84rem}.recipes-empty-detail{display:grid;align-content:center;justify-items:start;min-height:490px;max-width:470px;margin:auto}.recipes-empty-detail h2{margin:0 0 9px;font-size:2rem}.recipes-empty-detail p{color:var(--recipe-muted)}
|
||||
.recipes-info{display:grid;gap:12px}.recipes-info .recipes-panel{padding:18px}.recipes-facts{margin:0}.recipes-facts div{display:flex;justify-content:space-between;gap:8px;padding:8px 0;border-bottom:1px solid var(--recipe-line);font-size:.82rem}.recipes-facts div:last-child{border-bottom:0}.recipes-facts dt{color:var(--recipe-muted)}.recipes-facts dd{margin:0;font-weight:700}.recipes-info p{margin:0 0 9px;font-size:.82rem}.recipes-info p:last-child{margin-bottom:0}.recipes-info a:not(.recipes-action){color:var(--recipe-accent)}.recipes-action{display:block;padding:9px 0;border-bottom:1px solid var(--recipe-line);font-size:.84rem;text-decoration:none}.recipes-action:last-child{border:0}.recipes-action--danger{color:#b6413b}
|
||||
.recipes-layout--form{display:block;max-width:1100px}.recipes-form-header{margin:0 0 23px}.recipes-form-header>a{color:var(--recipe-accent);font-size:.85rem;font-weight:700}.recipes-form-header h1{margin:8px 0 4px;font-size:2.7rem}.recipes-form-header p{margin:0;color:var(--recipe-muted)}.recipes-edit-card{display:grid;gap:28px;padding:24px;border:1px solid var(--recipe-line);border-radius:17px;background:var(--recipe-surface)}.recipes-edit-card section+section{padding-top:24px;border-top:1px solid var(--recipe-line)}.recipes-edit-card h2{margin:0 0 16px;font-size:1.25rem}.recipes-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.recipes-field{min-width:0}.recipes-field label:not(.recipes-checkbox){display:block;margin:0 0 5px;font-size:.81rem;font-weight:700}.recipes-field input:not([type=checkbox]),.recipes-field textarea,.recipes-field select{width:100%;min-height:43px;padding:9px 10px;border:1px solid #cbd3cb;border-radius:8px;color:var(--recipe-ink);background:var(--recipe-surface)}.recipes-field textarea{min-height:94px;resize:vertical}.recipes-field small{display:block;margin-top:4px;color:var(--recipe-muted);font-size:.73rem}.recipes-field--title,.recipes-field--description,.recipes-field--instructions_markdown,.recipes-field--notes_markdown,.recipes-field--photo,.recipes-field--remove_photo{grid-column:1/-1}.recipes-field--photo input{height:auto}.recipes-checkbox{display:inline-flex;align-items:center;gap:7px;font-size:.8rem}.recipes-checkbox input{width:17px;height:17px;accent-color:var(--recipe-accent)}.recipes-current-photo{display:block;width:170px;max-height:120px;margin:0 0 9px;border-radius:9px;object-fit:cover}.recipes-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.recipes-section-heading h2{margin:0 0 2px}.recipes-section-heading p{margin:0;color:var(--recipe-muted);font-size:.8rem}.recipes-ingredient-forms{display:grid;gap:12px}.recipes-ingredient-form{padding:14px;border:1px solid var(--recipe-line);border-radius:12px;background:var(--recipe-soft)}.recipes-ingredient-form__main{display:grid;grid-template-columns:minmax(0,1fr) 110px 120px;gap:10px}.recipes-ingredient-form__more{margin-top:9px}.recipes-ingredient-form__more summary{color:var(--recipe-accent);font-size:.8rem;cursor:pointer}.recipes-ingredient-form__more .recipes-form-grid{padding-top:12px}.recipes-form-error,.recipes-field .errorlist{margin:7px 0;color:#b6413b;font-size:.8rem}.recipes-form-actions{display:flex;align-items:center;gap:20px;padding-top:19px;border-top:1px solid var(--recipe-line)}.recipes-form-actions>a,.recipes-delete a{color:var(--recipe-accent)}.recipes-delete{max-width:620px}.recipes-delete h1{font-size:2.3rem}.recipes-delete form{display:flex;align-items:center;gap:20px}
|
||||
body[data-theme=dark] .recipes-layout{--recipe-surface:#222b25;--recipe-line:#435046;--recipe-ink:#eaf0ea;--recipe-muted:#afbbb2;--recipe-soft:#29352d;--recipe-accent:#a7d9b6}body[data-theme=dark] .recipes-list-item:hover,body[data-theme=dark] .recipes-list-item--selected{background:#2a3b30}body[data-theme=dark] .recipes-list-item__placeholder,body[data-theme=dark] .recipes-photo-placeholder{color:#b8e4c5;background:#314d39;border-color:#5d8968}body[data-theme=dark] .recipes-list-item__tags span,body[data-theme=dark] .recipes-chips span{background:#354339}body[data-theme=dark] .recipes-search-row button,body[data-theme=dark] .recipes-filter-apply,body[data-theme=dark] .recipes-outline-button,body[data-theme=dark] .recipes-search-row input,body[data-theme=dark] .recipes-filter-grid select,body[data-theme=dark] .recipes-field input:not([type=checkbox]),body[data-theme=dark] .recipes-field textarea,body[data-theme=dark] .recipes-field select{border-color:#526055;background:var(--recipe-surface);color:var(--recipe-ink)}
|
||||
@media(max-width:1399px){.recipes-layout:not(.recipes-layout--form){grid-template-columns:minmax(260px,320px) minmax(0,1fr)}.recipes-info{grid-column:2;grid-template-columns:repeat(2,minmax(0,1fr))}.recipes-info .recipes-panel:last-child{grid-column:1/-1}.recipes-hero{grid-template-columns:minmax(170px,40%) minmax(0,1fr)}}
|
||||
@media(max-width:991px){.recipes-layout:not(.recipes-layout--form){grid-template-columns:minmax(0,1fr)}.recipes-browser,.recipes-detail,.recipes-info{grid-column:1}.recipes-list{grid-template-columns:repeat(2,minmax(0,1fr))}.recipes-hero{grid-template-columns:minmax(170px,38%) minmax(0,1fr)}.recipes-info{grid-template-columns:repeat(2,minmax(0,1fr))}.recipes-info .recipes-panel:last-child{grid-column:auto}}
|
||||
@media(max-width:767px){.page-content.recipes-page-content{padding-top:25px}.recipes-layout--list .recipes-detail,.recipes-layout--list .recipes-info{display:none}.recipes-layout--detail .recipes-browser{display:none}.recipes-browser__heading h1{font-size:2.4rem}.recipes-detail{padding:16px}.recipes-hero{grid-template-columns:1fr;gap:15px}.recipes-hero>img,.recipes-photo-placeholder{height:230px}.recipes-hero h2{font-size:2rem}.recipes-content-grid,.recipes-info{grid-template-columns:1fr}.recipes-list{grid-template-columns:1fr}.recipes-form-grid{grid-template-columns:1fr}.recipes-field--title,.recipes-field--description,.recipes-field--instructions_markdown,.recipes-field--notes_markdown,.recipes-field--photo,.recipes-field--remove_photo{grid-column:auto}.recipes-ingredient-form__main{grid-template-columns:minmax(0,1fr) minmax(90px,1fr)}.recipes-ingredient-form__main .recipes-field:first-child{grid-column:1/-1}.recipes-edit-card{padding:18px}.recipes-section-heading{align-items:flex-start;flex-wrap:wrap}.recipes-section-heading button{width:100%}}
|
||||
@media(max-width:400px){.recipes-browser__heading{display:block}.recipes-new{margin-top:12px}.recipes-filter-grid{grid-template-columns:1fr}.recipes-detail__top{flex-wrap:wrap}.recipes-ingredient-form__main{grid-template-columns:1fr 1fr}}
|
||||
Reference in New Issue
Block a user