Render the pedigree top-down as a family tree
Replace the indented ancestry list with a top-down chart: the dog on top, sire (left) and dam (right) branching below, connected by lines drawn with each node's CSS ::before/::after (a nested <ul>/<li> tree). It shows three generations by default and each dog expands to trace the line further back; deeper levels get wide, so the view scrolls horizontally.
This commit is contained in:
+80
-28
@@ -1123,59 +1123,111 @@ section.collapsed > :not(h2) { display: none; }
|
||||
.ped-subject-name { font-size: 1.15rem; font-weight: 700; }
|
||||
.ped-subject-meta { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
|
||||
|
||||
/* the tree */
|
||||
/* Top-down family tree: the dog on top, parents branching below, connected by
|
||||
lines drawn with each <li>'s ::before/::after (the classic CSS tree). Wider
|
||||
than the screen once expanded, so the container scrolls horizontally. */
|
||||
.pedigree-tree {
|
||||
overflow-x: auto;
|
||||
padding-bottom: 24px;
|
||||
padding: 8px 0 28px;
|
||||
}
|
||||
.ped-node { position: relative; }
|
||||
.ped-tree-h, .ped-tree-h ul {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.ped-tree-h {
|
||||
/* "safe" centers when the tree fits and falls back to start-aligned (no
|
||||
clipped/unreachable left edge) once it's wider than the screen. */
|
||||
justify-content: safe center;
|
||||
min-width: max-content;
|
||||
padding: 4px 16px 12px;
|
||||
}
|
||||
.ped-tree-h ul {
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
padding-top: 22px; /* room for the connector from the parent above */
|
||||
}
|
||||
.ped-tree-h li {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 22px 6px 0;
|
||||
}
|
||||
/* Elbow from each child up to the horizontal bar shared by its siblings. */
|
||||
.ped-tree-h li::before,
|
||||
.ped-tree-h li::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
height: 22px;
|
||||
border-top: 2px solid var(--border);
|
||||
}
|
||||
.ped-tree-h li::before { right: 50%; }
|
||||
.ped-tree-h li::after { left: 50%; border-left: 2px solid var(--border); }
|
||||
/* Vertical drop from a parent card down to its children's bar. */
|
||||
.ped-tree-h ul::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
height: 22px;
|
||||
border-left: 2px solid var(--border);
|
||||
}
|
||||
/* A lone parent connects with a straight line, no elbow. */
|
||||
.ped-tree-h li:only-child::before,
|
||||
.ped-tree-h li:only-child::after { display: none; }
|
||||
/* Trim the outer half-lines at the ends of a sibling row. */
|
||||
.ped-tree-h li:first-child::before,
|
||||
.ped-tree-h li:last-child::after { border: 0 none; }
|
||||
.ped-tree-h li:last-child::before { border-right: 2px solid var(--border); }
|
||||
/* The dog sits on top with no connector above it. */
|
||||
.ped-tree-h > li { padding-top: 0; }
|
||||
.ped-tree-h > li::before,
|
||||
.ped-tree-h > li::after { display: none; }
|
||||
/* Collapsed: hide the ancestry below this dog (and its connectors go with it). */
|
||||
.ped-tree-h li.collapsed > ul { display: none; }
|
||||
|
||||
.ped-card {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 6px 24px 6px 28px;
|
||||
margin: 3px 0;
|
||||
width: 140px;
|
||||
box-sizing: border-box;
|
||||
padding: 7px 18px 7px 20px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface);
|
||||
box-shadow: var(--shadow);
|
||||
text-align: center;
|
||||
}
|
||||
.ped-name { font-weight: 600; font-size: 0.95rem; }
|
||||
.ped-name { font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
|
||||
.ped-name.ped-unknown { color: var(--muted); font-weight: 500; font-style: italic; }
|
||||
.ped-titles { font-size: 0.72rem; color: var(--accent); margin-top: 1px; }
|
||||
.ped-titles { font-size: 0.66rem; color: var(--accent); margin-top: 2px; line-height: 1.2; }
|
||||
.ped-reg {
|
||||
font-size: 0.72rem;
|
||||
font-size: 0.66rem;
|
||||
color: var(--muted);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
/* lineage spine: children indented under the card */
|
||||
.ped-children {
|
||||
margin-left: 16px;
|
||||
padding-left: 14px;
|
||||
border-left: 2px solid var(--border);
|
||||
}
|
||||
.ped-node.collapsed > .ped-children { display: none; }
|
||||
|
||||
/* sire ♂ (blue) above dam ♀ (purple) markers on the parent-role cards */
|
||||
.ped-sire > .ped-card { border-left: 3px solid var(--sleep); }
|
||||
.ped-dam > .ped-card { border-left: 3px solid var(--training); }
|
||||
/* sire ♂ (blue) / dam ♀ (purple) accents on the parent cards */
|
||||
.ped-sire > .ped-card { border-top: 3px solid var(--sleep); }
|
||||
.ped-dam > .ped-card { border-top: 3px solid var(--training); }
|
||||
.ped-sire > .ped-card::after,
|
||||
.ped-dam > .ped-card::after {
|
||||
position: absolute;
|
||||
right: 7px;
|
||||
top: 6px;
|
||||
font-size: 0.75rem;
|
||||
right: 6px;
|
||||
top: 5px;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
.ped-sire > .ped-card::after { content: "♂"; color: var(--sleep); }
|
||||
.ped-dam > .ped-card::after { content: "♀"; color: var(--training); }
|
||||
|
||||
/* expand/collapse toggle */
|
||||
/* expand/collapse toggle (top-left of the card) */
|
||||
.ped-toggle {
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
width: 18px; height: 18px;
|
||||
padding: 0;
|
||||
font-size: 0.9rem;
|
||||
|
||||
Reference in New Issue
Block a user