diff --git a/css/book-layout.css b/css/book-layout.css new file mode 100644 index 0000000..cf0d92e --- /dev/null +++ b/css/book-layout.css @@ -0,0 +1,156 @@ +/* Reset body to a layout container (book-page.css targets body for page content) */ +html, body { + height: 100vh; + overflow: hidden; + display: flex; + flex-direction: column; + padding: 0; + max-width: unset; + margin: 0; + background-image: none; +} + +#layout { + display: flex; + flex: 1; + overflow: hidden; +} + +/* ── Sidebar ── */ +#sidebar { + width: 270px; + flex-shrink: 0; + display: flex; + flex-direction: column; + background: var(--surface); + border-right: 1px solid var(--border-bright); + overflow: hidden; +} + +#sidebar-header { + padding: 14px 16px; + background: var(--surface2); + border-bottom: 1px solid var(--border-bright); + flex-shrink: 0; +} + +#sidebar-header p { + font-family: var(--font-mono); + font-size: 0.7rem; + color: var(--text-dim); + margin-top: 4px; +} + +#page-list { + flex: 1; + overflow-y: auto; + list-style: none; + padding: 4px 0; +} + +#page-list li button { + width: 100%; + text-align: left; + padding: 6px 14px; + background: none; + border: none; + cursor: pointer; + color: var(--text-dim); + font-family: var(--font-body); + font-size: 0.88rem; + display: flex; + gap: 10px; + align-items: baseline; + transition: background 0.15s, color 0.15s; +} + +#page-list li button:hover { + background: var(--surface2); + color: var(--text); +} + +#page-list li.active button { + background: var(--surface3); + color: var(--teal); +} + +.page-num { + flex-shrink: 0; + min-width: 24px; + font-family: var(--font-mono); + font-size: 0.72rem; + color: var(--border-bright); +} + +li.active .page-num { + color: var(--teal-dim); +} + +/* ── Main area ── */ +#main { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; +} + +/* ── Nav bar ── */ +#nav { + display: flex; + align-items: center; + gap: 10px; + padding: 10px 20px; + background: var(--surface); + border-bottom: 1px solid var(--border-bright); + flex-shrink: 0; +} + +#page-title { + flex: 1; + text-align: center; + font-family: var(--font-display); + font-size: 0.65rem; + letter-spacing: 0.12em; + text-transform: uppercase; + color: var(--text); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#page-indicator { + font-family: var(--font-mono); + font-size: 0.72rem; + color: var(--text-dim); + white-space: nowrap; +} + +/* ── Scrollable content ── */ +#content { + flex: 1; + overflow-y: auto; + background: var(--bg); + background-image: + radial-gradient(ellipse at 20% 10%, rgba(78,205,196,.04) 0%, transparent 50%), + radial-gradient(ellipse at 80% 90%, rgba(201,168,76,.04) 0%, transparent 50%); +} + +/* ── Page sections ── */ +.page-section { + max-width: 860px; + margin: 0 auto; + padding: 32px; + border-bottom: 1px solid var(--border); +} + +.page-section:last-child { + border-bottom: none; + min-height: calc(100vh - 80px); +} + +/* Override book-page.css header rule inside sections */ +.page-section header { + border-bottom: 1px solid var(--border); + padding-bottom: 0.8em; + margin-bottom: 1.4em; +} diff --git a/src/BookIndex.jsx b/src/BookIndex.jsx index 37f304e..d59e69d 100644 --- a/src/BookIndex.jsx +++ b/src/BookIndex.jsx @@ -1,164 +1,5 @@ import React from 'react'; -const INLINE_CSS = ` - /* Reset body to a layout container (book-page.css targets body for page content) */ - html, body { - height: 100vh; - overflow: hidden; - display: flex; - flex-direction: column; - padding: 0; - max-width: unset; - margin: 0; - background-image: none; - } - - #layout { - display: flex; - flex: 1; - overflow: hidden; - } - - /* ── Sidebar ── */ - #sidebar { - width: 270px; - flex-shrink: 0; - display: flex; - flex-direction: column; - background: var(--surface); - border-right: 1px solid var(--border-bright); - overflow: hidden; - } - - #sidebar-header { - padding: 14px 16px; - background: var(--surface2); - border-bottom: 1px solid var(--border-bright); - flex-shrink: 0; - } - - #sidebar-header p { - font-family: var(--font-mono); - font-size: 0.7rem; - color: var(--text-dim); - margin-top: 4px; - } - - #page-list { - flex: 1; - overflow-y: auto; - list-style: none; - padding: 4px 0; - } - - #page-list li button { - width: 100%; - text-align: left; - padding: 6px 14px; - background: none; - border: none; - cursor: pointer; - color: var(--text-dim); - font-family: var(--font-body); - font-size: 0.88rem; - display: flex; - gap: 10px; - align-items: baseline; - transition: background 0.15s, color 0.15s; - } - - #page-list li button:hover { - background: var(--surface2); - color: var(--text); - } - - #page-list li.active button { - background: var(--surface3); - color: var(--teal); - } - - .page-num { - flex-shrink: 0; - min-width: 24px; - font-family: var(--font-mono); - font-size: 0.72rem; - color: var(--border-bright); - } - - li.active .page-num { - color: var(--teal-dim); - } - - /* ── Main area ── */ - #main { - flex: 1; - display: flex; - flex-direction: column; - overflow: hidden; - } - - /* ── Nav bar ── */ - #nav { - display: flex; - align-items: center; - gap: 10px; - padding: 10px 20px; - background: var(--surface); - border-bottom: 1px solid var(--border-bright); - flex-shrink: 0; - } - - #page-title { - flex: 1; - text-align: center; - font-family: var(--font-display); - font-size: 0.65rem; - letter-spacing: 0.12em; - text-transform: uppercase; - color: var(--text); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - #page-indicator { - font-family: var(--font-mono); - font-size: 0.72rem; - color: var(--text-dim); - white-space: nowrap; - } - - /* ── Scrollable content ── */ - #content { - flex: 1; - overflow-y: auto; - background: var(--bg); - background-image: - radial-gradient(ellipse at 20% 10%, rgba(78,205,196,.04) 0%, transparent 50%), - radial-gradient(ellipse at 80% 90%, rgba(201,168,76,.04) 0%, transparent 50%); - } - - /* ── Page sections ── */ - .page-section { - max-width: 860px; - margin: 0 auto; - padding: 32px; - border-bottom: 1px solid var(--border); - } - - .page-section:last-child { - border-bottom: none; - min-height: calc(100vh - 80px); - } - - /* Override book-page.css header rule inside sections */ - .page-section header { - border-bottom: 1px solid var(--border); - padding-bottom: 0.8em; - margin-bottom: 1.4em; - } -`; - function buildScript(pageNums) { return ` const PAGES = [${pageNums.join(',')}]; @@ -253,7 +94,7 @@ export default function BookIndex({ title, logoText, pages }) { rel="stylesheet" /> - +