Skip to content
Clone
main
429 lines 11.9 KB CSS
/*
* Unifies server-rendered HTML fragments (`[data-component="git-*"]`) with
* the app-shell design language. Colors come from the same `--shell-*`
* tokens the React components use; the README sandbox iframe receives a copy
* of those variables injected at runtime, so fragments and app chrome share
* one palette (light and dark).
*/
.repo-embed {
font-size: 13px;
line-height: 1.55;
color: var(--shell-ink, #1c1e22);
word-break: break-word;
}
/*
* Server fragments are laid out against the column they are mounted in, so
* that column is the query container; it also owns the horizontal pan when a
* fragment cannot fit at all.
*/
.repo-embed-scroll {
container-type: inline-size;
overflow-x: auto;
}
/* ---------- file tree -------------------------------------------------- */
.repo-embed [data-component="git-tree"] {
border: 2px solid var(--shell-hairline, #dde0e6);
border-radius: 10px;
background: var(--shell-surface, #fff);
overflow: hidden;
/* Fixed layout keeps the three lanes from trading places; the width itself
comes from the container query below so a squeezed desktop column and a
phone get the same readable result. */
table-layout: fixed;
}
.repo-embed [data-component="git-tree"] thead {
background: var(--shell-field, #f2f3f6);
}
.repo-embed [data-component="git-tree"] th {
text-align: left;
font-family: ui-monospace, monospace;
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1.2px;
color: var(--shell-ink-muted, #8b8f99);
padding: 8px 12px;
white-space: nowrap;
}
/* Name keeps a share of the row, the commit column takes the rest and the
date stays a fixed lane so the three never trade places while scrolling. */
.repo-embed [data-component="git-tree"] th:nth-child(1) {
width: 34%;
}
.repo-embed [data-component="git-tree"] th:nth-child(3) {
width: 88px;
}
.repo-embed [data-component="git-tree"] td:nth-child(2) a {
display: flex;
min-width: 0;
align-items: center;
gap: 8px;
}
.repo-embed [data-component="git-tree"] td:nth-child(2) a > span:last-child {
min-width: 0;
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The short sha is a fixed chip: it must never be squeezed into a vertical stack. */
.repo-embed [data-component="git-tree"] td:nth-child(2) code {
flex: none;
white-space: nowrap;
}
.repo-embed [data-component="git-tree"] td:nth-child(1) a {
display: flex;
min-width: 0;
align-items: center;
gap: 7px;
}
.repo-tree-icon {
display: inline-flex;
width: 16px;
height: 16px;
flex: none;
color: var(--shell-ink-muted, #8b8f99);
}
.repo-tree-icon svg,
.repo-tree-icon img {
display: block;
width: 16px;
height: 16px;
}
.repo-tree-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.repo-embed [data-component="git-tree"] th:last-child {
text-align: right;
}
.repo-embed [data-component="git-tree"] td {
padding: 7px 12px;
border-top: 1px solid var(--shell-hairline, #dde0e6);
vertical-align: middle;
}
.repo-embed [data-component="git-tree"] tbody tr:hover > td {
background: color-mix(in srgb, var(--shell-active, #dee1e8) 45%, transparent);
}
.repo-embed [data-component="git-tree"] td:last-child {
text-align: right;
font-size: 12px;
color: var(--shell-ink-muted, #8b8f99);
white-space: nowrap;
}
/* ---------- links, chips, code (shared) --------------------------------- */
.repo-embed a {
color: inherit;
text-decoration: none;
}
.repo-embed a:hover {
text-decoration: underline;
}
.repo-embed [data-component="git-tree"] code,
.repo-embed .markdown-body code {
background: var(--shell-active, #dee1e8);
border-radius: 4px;
padding: 1px 6px;
font-family: var(--font-mono, ui-monospace, monospace);
font-size: 11px;
text-decoration: none;
}
.repo-embed [data-component="git-tree"] td:first-child a {
font-weight: 600;
}
/* ---------- blob viewer -------------------------------------------------- */
.repo-embed [data-component="git-blob-content"] {
border: 2px solid var(--shell-hairline, #dde0e6);
border-radius: 10px;
background: var(--shell-surface, #fff);
overflow: hidden;
}
.repo-embed [data-component="git-blob-content"] table {
width: 100%;
border-collapse: collapse;
font-family: ui-monospace, monospace;
font-size: 12px;
}
.repo-embed [data-component="git-blob-content"] tr[id^="L"] > td:first-child {
width: 3.5rem;
min-width: 3.5rem;
text-align: right;
padding: 1px 10px;
color: var(--shell-ink-muted, #8b8f99);
background: var(--shell-field, #f2f3f6);
border-right: 1px solid var(--shell-hairline, #dde0e6);
user-select: none;
}
.repo-embed [data-component="git-blob-content"] tr[id^="L"] > td:last-child {
white-space: pre;
padding: 1px 14px;
}
.repo-embed [data-component="git-blob-content"] tr[id^="L"]:hover > td {
background: color-mix(in srgb, var(--shell-active, #dee1e8) 40%, transparent);
}
.repo-embed [data-component="git-blob-content"] tr[id^="L"]:hover > td:first-child {
color: var(--shell-ink, #1c1e22);
}
/* ---------- language card (already framed by the aside card) ------------- */
.repo-embed [data-component="git-languages"] {
border: 0;
border-radius: 0;
background: transparent;
padding: 0;
font-size: 12px;
}
.repo-embed [data-component="git-languages"] > div:first-of-type {
display: none; /* the aside card has its own heading */
}
/*
* Geometry is spelled out here rather than inherited from the app's Tailwind
* build: fragment utility classes only work when we happen to use the same
* class in our own components, which is not a contract worth relying on.
*/
.repo-embed [data-component="git-languages"] > div:nth-of-type(2) {
display: flex;
flex-wrap: nowrap;
height: 8px;
width: 100%;
overflow: hidden;
border-radius: 9999px;
background: var(--shell-field, #f2f3f6);
}
.repo-embed [data-component="git-languages"] > div:nth-of-type(2) > div {
height: 100%;
}
/* Legend: one language per row, name left / share right. */
.repo-embed [data-component="git-languages"] > div:last-of-type {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: stretch;
gap: 3px;
padding-top: 6px;
}
.repo-embed [data-component="git-languages"] > div:last-of-type > div {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.repo-embed [data-component="git-languages"] > div:last-of-type span:first-child {
width: 8px;
height: 8px;
flex: none;
border-radius: 9999px;
}
.repo-embed [data-component="git-languages"] > div:last-of-type span:nth-child(2) {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--shell-ink, #1c1e22);
font-weight: 500;
}
.repo-embed [data-component="git-languages"] > div:last-of-type span:last-child {
margin-left: auto;
padding-left: 8px;
flex: none;
color: var(--shell-ink-muted, #8b8f99);
font-variant-numeric: tabular-nums;
}
/* ---------- last-commit strip / error placeholders ----------------------- */
.repo-embed [data-component="git-last-commit"] {
border: 0;
border-radius: 0;
padding: 2px 0;
background: transparent;
}
.repo-embed [data-component="git-err"] {
color: var(--shell-ink-muted, #8b8f99);
font-style: italic;
}
/* ---------- readme typography ------------------------------------------- */
.repo-embed .markdown-body,
.repo-embed [data-component="git-readme"] {
font-family: var(
--font-sans,
BlinkMacSystemFont,
"Segoe UI",
system-ui,
Roboto,
"Noto Sans",
Ubuntu,
Cantarell,
"Helvetica Neue",
Arial,
"PingFang SC",
"Source Han Sans SC",
"Microsoft YaHei UI",
"Microsoft YaHei",
"Noto Sans CJK SC",
sans-serif
);
}
.repo-embed .markdown-body h1,
.repo-embed [data-component="git-readme"] h1 {
font-family: inherit;
font-size: 24px;
font-weight: 700;
letter-spacing: -0.01em;
border-bottom: 1px solid var(--shell-hairline, #dde0e6);
padding-bottom: 0.3em;
margin: 0.6em 0 0.5em;
}
.repo-embed .markdown-body h2,
.repo-embed [data-component="git-readme"] h2 {
font-family: inherit;
font-size: 17.5px;
font-weight: 700;
letter-spacing: -0.01em;
border-bottom: 1px solid var(--shell-hairline, #dde0e6);
padding-bottom: 0.25em;
margin: 1.4em 0 0.5em;
}
.repo-embed .markdown-body h3,
.repo-embed [data-component="git-readme"] h3 {
font-family: inherit;
font-size: 15px;
font-weight: 600;
margin: 1.3em 0 0.4em;
}
.repo-embed .markdown-body h4,
.repo-embed [data-component="git-readme"] h4 {
font-family: inherit;
font-size: 13.5px;
font-weight: 600;
margin: 1.2em 0 0.35em;
}
.repo-embed .markdown-body p,
.repo-embed [data-component="git-readme"] p {
margin: 0.55em 0;
}
.repo-embed .markdown-body a,
.repo-embed [data-component="git-readme"] a {
color: var(--shell-ink, #23272b);
}
.repo-embed .markdown-body ul,
.repo-embed .markdown-body ol,
.repo-embed [data-component="git-readme"] ul,
.repo-embed [data-component="git-readme"] ol {
padding-left: 1.6em;
margin: 0.55em 0;
}
.repo-embed .markdown-body blockquote,
.repo-embed [data-component="git-readme"] blockquote {
margin: 0.7em 0;
padding: 0.15em 1em;
border-left: 3px solid var(--shell-active, #dee1e8);
color: var(--shell-ink-muted, #8b8f99);
}
.repo-embed .markdown-body pre,
.repo-embed [data-component="git-readme"] pre {
background: var(--shell-field, #f2f3f6);
border: 1px solid var(--shell-hairline, #dde0e6);
border-radius: 8px;
padding: 12px;
overflow-x: auto;
font-family: var(--font-mono, ui-monospace, monospace);
font-size: 12.5px;
line-height: 1.65;
white-space: pre;
}
.repo-embed .markdown-body pre code,
.repo-embed [data-component="git-readme"] pre code {
background: transparent;
padding: 0;
font-size: inherit;
}
.repo-embed .markdown-body table,
.repo-embed [data-component="git-readme"] table {
border-collapse: collapse;
margin: 0.7em 0;
}
.repo-embed .markdown-body th,
.repo-embed .markdown-body td,
.repo-embed [data-component="git-readme"] th,
.repo-embed [data-component="git-readme"] td {
border: 1px solid var(--shell-hairline, #dde0e6);
padding: 6px 10px;
}
.repo-embed .markdown-body th,
.repo-embed [data-component="git-readme"] th {
background: var(--shell-field, #f2f3f6);
}
.repo-embed .markdown-body img,
.repo-embed [data-component="git-readme"] img {
max-width: 100%;
}
.repo-embed .markdown-body hr,
.repo-embed [data-component="git-readme"] hr {
border: none;
border-top: 1px solid var(--shell-hairline, #dde0e6);
margin: 1.2em 0;
}
/* ---------- generic fallbacks for unnamed fragment markup ---------------- */
.repo-embed table {
width: 100%;
border-collapse: collapse;
}
.repo-embed th {
text-align: left;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 1.2px;
color: var(--shell-ink-muted, #8b8f99);
padding: 8px 12px;
}
.repo-embed td {
padding: 7px 12px;
border-top: 1px solid var(--shell-hairline, #dde0e6);
vertical-align: top;
}
.repo-embed pre {
overflow-x: auto;
font-family: ui-monospace, monospace;
font-size: 12px;
}
.repo-embed img {
max-width: 100%;
}
/* The tree adapts to the column it actually got, not the viewport: a desktop
window with the sidebar and info aside open can be narrower than a tablet
in full screen. Below the threshold the date lane is dropped so the file
list itself never needs a horizontal pan. */
@container (max-width: 560px) {
.repo-embed [data-component="git-tree"] th:nth-child(3),
.repo-embed [data-component="git-tree"] td:nth-child(3) {
display: none;
}
.repo-embed [data-component="git-tree"] th:nth-child(1) {
width: 44%;
}
}
/* ---------- media safety nets ---------------------------------------------
* Server markup sizes icons with Tailwind utilities (`h-4 w-4`) that are not
* shipped for fragments; an unsized inline <svg> would otherwise fall back to
* the 300x150 replaced-element default and blow out the layout. */
.repo-embed img {
height: auto;
}
.repo-embed video,
.repo-embed canvas {
max-width: 100%;
}
.repo-embed svg:not([width]):not([height]) {
width: 1em;
height: 1em;
flex: none;
}