Files
Harvey_Team_Page/design/glyph-slot-2026-10-14/measure-containers.cjs
T
FastD e352335822 Filter bar with hover layer, icon-only project links, design reports
Filters: the panel is a bar (status segment, always visible) plus a body that lives as a layer
under it - collapsed by default, expands on hover/focus/tap and never moves the case grid; the
reset control appears only when a facet is limited; width capped at 720px (measured 45px slack
against 477px before). Facet research report is included.

Links: project links in the mini card and in the project window are icon-only buttons with a
uniform slot (16px card / 18px window) and the accessible name in aria-label; studio contacts
(mail, VK, RuStore) live outside the cards.

Team and page: real photos from the public TITANS team page go to the member window while the
card keeps the mascot; the portfolio gains the First Step Radio card and genre values, the
process block became an individual-approach section, plus a cookie bar and a removable ticker.

Design folders under design/ keep reports, measurements, scripts and the .pen; probe and
before/after screenshot dumps, editor backups and caches are removed. Background-variant and
palette previews stay until the client picks one.
2026-10-15 05:50:52 +03:00

110 lines
6.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Замеры контейнеров и ширин кнопок-ссылок на живой странице (§10.28, kanban t_d3adf730).
* Ничего не пишет в файлы проекта, только читает DOM. Ответ на вопрос «что куда влезает»:
* - ширина колонки фактов и ряда ссылок в мини-карточке (1440 / 390);
* - ширина ряда ссылок в большом окне (1440 / 390);
* - ширина каждой кнопки в текущем CSS;
* - сценарии «сколько кнопок влезает в одну строку» по реальному замеру (без догадок).
*
* Запуск: node design/glyph-slot-2026-10-14/measure-containers.cjs
* Выход: stdout + containers.json рядом со скриптом.
*/
const fs = require('fs');
const path = require('path');
const { launch } = require('./pw.cjs');
const BASE = process.env.PAGE_URL || 'http://127.0.0.1:8765';
(async () => {
const browser = await launch();
const out = {};
for (const vp of [{ w: 1440, h: 900 }, { w: 390, h: 844 }]) {
const ctx = await browser.newContext({ viewport: { width: vp.w, height: vp.h } });
const p = await ctx.newPage();
await p.goto(BASE + '/src/', { waitUntil: 'load' });
await p.waitForTimeout(500);
const cards = await p.evaluate(() => {
const res = [];
document.querySelectorAll('.case-card').forEach((c) => {
c.scrollIntoView({ block: 'center' });
const facts = c.querySelector('.case-card__facts');
const box = c.querySelector('.case-card__links');
const body = c.querySelector('.case-card__body');
const r = (el) => (el ? { w: +el.getBoundingClientRect().width.toFixed(2), h: +el.getBoundingClientRect().height.toFixed(2) } : null);
res.push({
slug: c.getAttribute('data-slug'),
card: r(c), body: r(body), facts: r(facts), linksBox: r(box),
btns: box ? Array.from(box.querySelectorAll('a')).map((a) => ({
label: a.textContent.trim(), w: +a.getBoundingClientRect().width.toFixed(2)
})) : [],
lines: box ? new Set(Array.from(box.querySelectorAll('a')).map((a) => Math.round(a.getBoundingClientRect().top))).size : 0,
cs: box ? (() => { const s = getComputedStyle(box); return { gap: s.gap, wrap: s.flexWrap }; })() : null,
btnCs: box ? (() => { const a = box.querySelector('a'); const s = getComputedStyle(a); return { padding: s.padding, fontSize: s.fontSize, minH: s.minHeight, gap: s.gap, ls: s.letterSpacing }; })() : null
});
});
return res;
});
// окно: у First Step Radio две ссылки (главный CTA + ghost)
await p.evaluate(() => {
const c = document.querySelector('.case-card[data-slug="first-step-radio"]');
c.querySelector('.case-card__more').click();
});
await p.waitForTimeout(450);
const win = await p.evaluate(() => {
const box = document.querySelector('#quickview .quickview__links');
const panel = document.querySelector('#quickview .quickview__panel');
const detail = document.querySelector('#quickview .quickview__detail');
const r = (el) => (el ? { w: +el.getBoundingClientRect().width.toFixed(2) } : null);
return {
linksBox: r(box), panel: r(panel), detail: r(detail),
btns: Array.from(box.querySelectorAll('a')).map((a) => ({ label: a.textContent.trim(), w: +a.getBoundingClientRect().width.toFixed(2) })),
gap: getComputedStyle(box).gap,
btnCs: (() => { const a = box.querySelector('a'); const s = getComputedStyle(a); return { padding: s.padding, fontSize: s.fontSize, minH: s.minHeight, gap: s.gap, ls: s.letterSpacing }; })()
};
});
out[vp.w] = { cards, window: win };
await ctx.close();
}
// сценарии: сколько кнопок влезает в одну строку при текущих ширинах
const fit = (container, widths, gap) => {
let acc = 0, n = 0;
for (const w of widths) { const add = acc ? w + gap : w; if (acc + add > container) break; acc += add; n++; }
return { n, used: +acc.toFixed(2) };
};
const rep = { measured: out, fit: {} };
for (const width of [1440, 390]) {
const o = out[width];
rep.fit[width] = {};
for (const c of o.cards) {
if (!c.linksBox) { rep.fit[width][c.slug] = { linksBox: null, note: 'карточка без ссылок проекта' }; continue; }
const gap = parseFloat(c.cs.gap) || 0;
const widths = ['rustore', 'vk', 'site', 'video'].map((k) => (c.btns.find((b) => /RUSTORE/i.test(b.label)) || {}).w || 0);
rep.fit[width][c.slug] = {
linksBox: c.linksBox && c.linksBox.w,
current: c.btns.map((b) => b.label + ' ' + b.w),
lines: c.lines,
howManyFit: fit(c.linksBox ? c.linksBox.w : 0, c.btns.map((b) => b.w).concat(widths.filter(Boolean).slice(0, 0)), gap)
};
}
rep.fit[width].window = {
linksBox: o.window.linksBox && o.window.linksBox.w,
current: o.window.btns.map((b) => b.label + ' ' + b.w),
howManyFit: fit(o.window.linksBox ? o.window.linksBox.w : 0, o.window.btns.map((b) => b.w), parseFloat(o.window.gap) || 0)
};
}
fs.writeFileSync(path.join(__dirname, 'containers.json'), JSON.stringify(rep, null, 2) + '\n');
console.log(JSON.stringify(rep.fit, null, 1));
console.log('\n--- CSS кнопки (карточка) ---', JSON.stringify(out[1440].cards[0].btnCs));
console.log('--- CSS кнопки (окно) ---', JSON.stringify(out[1440].window.btnCs));
console.log('--- контейнеры 1440 ---', JSON.stringify(out[1440].cards.map((c) => ({ slug: c.slug, card: c.card.w, body: c.body.w, facts: c.facts.w, links: c.linksBox.w, lines: c.lines }))));
console.log('--- контейнеры 390 ---', JSON.stringify(out[390].cards.map((c) => ({ slug: c.slug, card: c.card.w, body: c.body.w, facts: c.facts.w, links: c.linksBox.w, lines: c.lines }))));
console.log('--- окно ---', JSON.stringify({ '1440': out[1440].window.linksBox, '390': out[390].window.linksBox }));
await browser.close();
})();