forked from unimatrix/web
Incorporate the supplied item card artwork and lore
This commit is contained in:
parent
3845592521
commit
68cf12ab4d
3 changed files with 742 additions and 22 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import {itemMaterialIcon,itemLoreModel,itemPublicHref} from './item-lore-model.mjs';
|
||||
const el=(tag,text,className)=>{const n=document.createElement(tag);if(text!==undefined)n.textContent=text;if(className)n.className=className;return n;};
|
||||
export function itemLoreStyles(){if(document.querySelector('link[data-item-lore]'))return;const css=el('link');css.rel='stylesheet';css.href=new URL('./item-lore.css',import.meta.url).href;css.dataset.itemLore='';document.head.append(css);}
|
||||
function section(title,rows,missing,cls=''){const box=el('section',undefined,'item-lore-section '+cls);box.append(el('h3',title));if(!rows.length)box.append(el('p',missing,'item-lore-missing'));else{const dl=el('dl');for(const row of rows)dl.append(el('dt',row.name),el('dd',row.value||row.level));box.append(dl);}return box;}
|
||||
function section(title,rows,missing,cls=''){const box=el('section',undefined,'item-lore-section '+cls);box.append(el('h3',title));if(!rows.length)box.append(el('p',missing,'item-lore-missing'));else{const dl=el('dl');for(const row of rows){const pair=el('div');pair.append(el('dt',row.name),el('dd',row.value||row.level));dl.append(pair);}box.append(dl);}return box;}
|
||||
export function itemLoreCard(record,{compact=false}={}){
|
||||
itemLoreStyles();const item=itemLoreModel(record),card=el('article',undefined,'item-lore-card'+(compact?' item-lore-compact':''));card.dataset.quality=item.quality||'unknown';
|
||||
const art=el('div',undefined,'item-lore-art'),scene=el('img');scene.src=item.art;scene.alt='';scene.loading='lazy';art.append(scene);card.append(art);
|
||||
const art=el('div',undefined,'item-lore-art'),scene=el('img');scene.src="https://www.dunerealms.com/assets/item-card-banner.png";scene.alt='';scene.loading='lazy';art.append(scene);card.append(art);
|
||||
const name=el('header',undefined,'item-lore-name'),icon=el('img');icon.src=item.icon;icon.alt='';icon.width=icon.height=64;icon.onerror=()=>{const fallback=itemMaterialIcon(item.material);if(fallback&&icon.src!==fallback){icon.src=fallback;return;}icon.onerror=null;icon.hidden=true;};name.append(icon,el('h2',item.title));card.append(name);
|
||||
const identity=el('div',undefined,'item-lore-identity');identity.append(el('strong',item.qualityLabel),el('em',item.markLabel));card.append(identity);
|
||||
if(item.organisationGear){card.dataset.organisationGear=item.organisationGear.kind;card.append(el('small',item.organisationGear.tag+' · Organisation equipment','item-lore-organisation'));}
|
||||
|
|
|
|||
|
|
@ -10,3 +10,45 @@
|
|||
.item-lore-card .item-lore-name h2{min-width:0;font-size:clamp(17px,6cqi,23px)!important;line-height:1.3;word-break:normal;overflow-wrap:break-word;hyphens:none}
|
||||
.item-lore-card .item-lore-identity{flex-wrap:wrap;gap:6px 12px}
|
||||
@container(max-width:260px){.item-lore-card .item-lore-name{grid-template-columns:40px minmax(0,1fr);gap:10px}.item-lore-card .item-lore-name img{width:40px;height:40px}.item-lore-card .item-lore-name h2{font-size:18px!important}}
|
||||
|
||||
/* ===== DuneRealms card v2: smooth futuristic Dune. Palette from dunerealms.com (#081e17 base, #102a23/#17372c panels, gold #e5b95e/#c4a255/#f2d593, cream #f5ead0). Every compartment is its own sub-box. ===== */
|
||||
.item-lore-card{--d-bg:#081e17;--d-panel:#102a23;--d-raise:#17372c;--d-gold:#e5b95e;--d-gold-d:#c4a255;--d-gold-l:#f2d593;--d-cream:#f5ead0;--d-text:#eae3cc;--d-muted:#b7c8b7;--d-line:rgba(229,185,94,.26);--d-glass:linear-gradient(180deg,rgba(23,55,44,.72),rgba(16,42,35,.55));
|
||||
background:radial-gradient(90% 55% at 100% 0,color-mix(in srgb,var(--quality) 20%,transparent),transparent 70%),linear-gradient(170deg,#12302a,var(--d-bg) 62%);
|
||||
border:1px solid var(--d-line);border-radius:20px;padding:0 14px 14px;color:var(--d-text);font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
|
||||
box-shadow:0 0 0 1px #000a,0 22px 50px #000b,0 0 34px color-mix(in srgb,var(--quality) 22%,transparent),inset 0 1px 0 rgba(255,255,255,.07)}
|
||||
.item-lore-card::before,.item-lore-card::after{content:none}
|
||||
/* art compartment */
|
||||
.item-lore-card .item-lore-art{height:112px;margin:0 -14px;border-radius:19px 19px 0 0;overflow:hidden;background:#0b211c}
|
||||
.item-lore-card .item-lore-art:after{background:linear-gradient(180deg,transparent 30%,#102a23f0 100%)}
|
||||
.item-lore-card .item-lore-art img{opacity:.85;filter:saturate(1.1) hue-rotate(-6deg)}
|
||||
/* header compartment: overlaps art, item socket in the right corner */
|
||||
.item-lore-card .item-lore-name{display:grid!important;grid-template-columns:minmax(0,1fr) 72px!important;gap:14px;align-items:center;margin-top:-30px;padding:14px 14px 14px 18px;position:relative;z-index:2;
|
||||
background:var(--d-glass);backdrop-filter:blur(10px);border:1px solid var(--d-line);border-radius:16px;box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 10px 24px #0008}
|
||||
.item-lore-card .item-lore-name h2{grid-column:1;grid-row:1;margin:0;color:var(--d-cream)!important;font:600 clamp(18px,6cqi,25px)/1.2 'Segoe UI',system-ui,sans-serif!important;letter-spacing:.07em;text-transform:uppercase;text-shadow:0 0 22px color-mix(in srgb,var(--quality) 60%,transparent)}
|
||||
.item-lore-card .item-lore-name img{grid-column:2;grid-row:1;width:72px!important;height:72px!important;padding:9px;box-sizing:border-box;border-radius:18px;image-rendering:pixelated;
|
||||
background:radial-gradient(circle at 50% 35%,color-mix(in srgb,var(--quality) 45%,#17372c),#0a1f19 75%);border:1px solid color-mix(in srgb,var(--quality) 70%,var(--d-gold));box-shadow:0 0 0 4px rgba(8,30,23,.8),0 0 26px color-mix(in srgb,var(--quality) 55%,transparent),inset 0 1px 0 rgba(255,255,255,.18)}
|
||||
/* identity compartment: chips */
|
||||
.item-lore-card .item-lore-identity{display:flex;flex-wrap:wrap;justify-content:flex-start;gap:8px;margin:10px 0 0;padding:10px 12px;border:1px solid var(--d-line);border-radius:14px;background:var(--d-glass)}
|
||||
.item-lore-card .item-lore-identity strong{display:inline-flex;align-items:center;gap:7px;padding:6px 12px;border-radius:999px;border:1px solid color-mix(in srgb,var(--quality) 70%,transparent);background:color-mix(in srgb,var(--quality) 18%,#0a1f19);color:var(--quality);font:700 11px/1 'Segoe UI',system-ui,sans-serif;letter-spacing:.22em;text-transform:uppercase}
|
||||
.item-lore-card .item-lore-identity strong::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--quality);box-shadow:0 0 10px var(--quality)}
|
||||
.item-lore-card .item-lore-identity em{display:inline-flex;align-items:center;padding:6px 12px;border-radius:999px;border:1px solid var(--d-line);background:rgba(0,0,0,.28);color:var(--d-gold-l);font:600 12px/1 'Segoe UI',system-ui,sans-serif;font-style:normal;letter-spacing:.16em}
|
||||
.item-lore-card .item-lore-season,.item-lore-card .item-lore-organisation{display:inline-block;margin:10px 0 0;padding:6px 12px;border-radius:999px;border:1px solid var(--d-line);background:rgba(0,0,0,.25);color:var(--d-gold-d);font-size:11px;letter-spacing:.2em;text-transform:uppercase}
|
||||
/* lore compartment */
|
||||
.item-lore-card .item-lore-story{margin:10px 0 0;padding:14px 16px;border:1px solid var(--d-line);border-radius:14px;background:var(--d-glass);position:relative;color:var(--d-muted);font:italic 14px/1.65 Georgia,serif}
|
||||
.item-lore-card .item-lore-story::before{content:'';position:absolute;left:0;top:14px;bottom:14px;width:3px;border-radius:3px;background:linear-gradient(180deg,var(--d-gold),transparent)}
|
||||
.item-lore-card .item-lore-story p{margin:4px 0}
|
||||
/* data compartments: enchantments, stats */
|
||||
.item-lore-card .item-lore-section{margin:10px 0 0;padding:12px 14px 8px;border:1px solid var(--d-line);border-radius:14px;background:var(--d-glass)}
|
||||
.item-lore-card .item-lore-section h3{display:flex;align-items:center;gap:10px;margin:0 0 8px;padding:0;border:0;background:none;color:var(--d-gold)!important;font:700 11px/1 'Segoe UI',system-ui,sans-serif!important;letter-spacing:.28em;text-transform:uppercase}
|
||||
.item-lore-card .item-lore-section h3::before{content:'';width:18px;height:2px;border-radius:2px;background:var(--d-gold)}
|
||||
.item-lore-card .item-lore-section h3::after{content:'';flex:1;height:1px;background:linear-gradient(90deg,var(--d-line),transparent)}
|
||||
.item-lore-card .item-lore-section dl{display:grid!important;grid-template-columns:1fr!important;gap:6px;margin:0;padding:0}
|
||||
.item-lore-card .item-lore-section dl>div{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:8px 12px;border-radius:10px;background:rgba(0,0,0,.26);border:1px solid rgba(229,185,94,.10)}
|
||||
.item-lore-card .item-lore-section dt{white-space:nowrap;margin:0;padding:0;border:0;color:var(--d-text)!important;font:500 13px/1.3 'Segoe UI',system-ui,sans-serif!important}
|
||||
.item-lore-card .item-lore-section dd{margin:0;padding:0;border:0;color:var(--d-gold-l);font:700 13px/1.3 'Segoe UI',system-ui,sans-serif;font-style:normal;font-variant-numeric:tabular-nums;text-align:right!important}
|
||||
.item-lore-card .item-lore-stats dd{color:#9fe0cf}
|
||||
.item-lore-card .item-lore-missing{margin:4px 0 6px;color:#8fa896;font-style:italic;font-size:13px}
|
||||
.item-lore-card .item-lore-details{display:block;margin:12px 0 0;padding:11px 14px;text-align:center;border-radius:12px;border:0;color:#16110a;background:linear-gradient(180deg,var(--d-gold-l),var(--d-gold));font:700 12px 'Segoe UI',system-ui,sans-serif;letter-spacing:.2em;text-transform:uppercase;text-decoration:none;box-shadow:0 6px 18px rgba(229,185,94,.25)}
|
||||
.item-lore-card.item-lore-compact .item-lore-art{height:80px}
|
||||
.item-lore-card.item-lore-compact .item-lore-name{grid-template-columns:minmax(0,1fr) 56px!important;margin-top:-24px;padding:10px 12px 10px 14px}
|
||||
.item-lore-card.item-lore-compact .item-lore-name img{width:56px!important;height:56px!important;border-radius:14px}
|
||||
|
|
|
|||
BIN
website/web/assets/item-card-banner.png
Normal file
BIN
website/web/assets/item-card-banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in a new issue

Staff