QQgit/preview/_reposearch_probe.html

56 lines
2.8 KiB
HTML
Raw Permalink 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.

<!DOCTYPE html>
<html lang="zh-CN" class="theme-qq-light">
<head>
<meta charset="utf-8">
<title>左栏仓库搜索框探针</title>
<!-- 加载线上真实样式,复现 DashboardRepoList.vue 里搜索框的 DOM,用来验证 padding-left 是否够 -->
<link rel="stylesheet" href="https://git.qyhhh.top/assets/css/index.css">
<link rel="stylesheet" href="https://git.qyhhh.top/assets/css/theme-qq-light.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-ui.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-pages.css">
<style>
body { padding: 24px; background: var(--color-body); }
.wrap { width: 248px; } /* 与控制台左栏同宽 */
.pad { padding: 12px; border: 1px dashed var(--color-secondary); margin-bottom: 24px; }
</style>
</head>
<body>
<div class="wrap page-content qq-dash">
<div class="qq-dash-shell" style="max-width:none;padding:0">
<div class="pad">
<p style="font-size:12px;margin:0 0 8px">当前线上样式</p>
<section class="qq-dash-card qq-dash-repos" style="margin:0">
<div id="dashboard-repo-list">
<div class="ui fluid action left icon input">
<input type="search" placeholder="查找仓库…">
<i class="icon"><svg width="16" height="16" viewBox="0 0 16 16"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg></i>
<div class="ui dropdown icon button"><svg width="16" height="16" viewBox="0 0 16 16"><path d="M.75 3h14.5a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1 0-1.5ZM3 7.75A.75.75 0 0 1 3.75 7h10.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 7.75Zm3 4a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z"></path></svg></div>
</div>
</div>
</section>
</div>
</div>
</div>
<pre id="out" style="margin-top:24px;font-size:12px"></pre>
<script>
// 量一下输入框的左内边距、图标位置,看文字会不会压在图标上
window.addEventListener('load', () => {
const input = document.querySelector('#dashboard-repo-list input[type="search"]');
const icon = document.querySelector('#dashboard-repo-list .ui.input > .icon');
const cs = getComputedStyle(input);
const ir = input.getBoundingClientRect();
const gr = icon.getBoundingClientRect();
document.getElementById('out').textContent = [
`input padding-left = ${cs.paddingLeft}`,
`input height = ${cs.height}`,
`input left = ${ir.left.toFixed(1)}`,
`icon left = ${gr.left.toFixed(1)} width = ${gr.width.toFixed(1)}`,
`图标右边缘 = ${(gr.left + gr.width).toFixed(1)} → 文字起点应 ≥ 该值 + 6`,
`文字起点 = ${(ir.left + parseFloat(cs.paddingLeft)).toFixed(1)}`,
].join('\n');
});
</script>
</body>
</html>