Touch up the mobile view, add syntax highlighting for markdown

This commit is contained in:
mrkmntal 2026-09-28 18:37:13 -04:00
commit 16450f4c1c
11 changed files with 863 additions and 57 deletions

View file

@ -14,6 +14,13 @@ html, body {
transition: background-color 0.15s ease, color 0.15s ease;
}
body {
display: flex;
flex-direction: column;
height: 100dvh;
overflow: hidden;
}
a {
color: var(--ansi-4);
text-decoration: none;
@ -38,6 +45,7 @@ button, input, select, textarea {
background-color: var(--app-bg);
border-bottom: 1px solid var(--ui-border);
user-select: none;
flex-shrink: 0;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
@ -58,14 +66,17 @@ button, input, select, textarea {
font-weight: 500;
}
/* Menus are opened by click (see `openMenu` in app.js), not CSS hover, so
that only one can be open at a time. `.open` both highlights the trigger
and reveals its dropdown. */
.menu-item:hover,
.menu-item:focus {
.menu-item:focus,
.menu-item.open {
background-color: var(--ui-hover);
outline: none;
}
.menu-item:hover .menu-dropdown,
.menu-item:focus-within .menu-dropdown {
.menu-item.open .menu-dropdown {
display: block;
}
@ -75,6 +86,12 @@ button, input, select, textarea {
top: calc(100% - 4px);
left: 0;
min-width: 180px;
/* The Theme menu has 28 entries; cap the height so it cannot run off
the bottom of the viewport (body has overflow: hidden). */
max-height: calc(100dvh - 48px);
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
background-color: var(--app-bg);
border: 1px solid var(--ui-border);
border-radius: 6px;
@ -131,6 +148,7 @@ button, input, select, textarea {
background-color: var(--app-bg);
border-bottom: 1px solid var(--ui-border);
gap: 12px;
flex-shrink: 0;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
@ -153,7 +171,7 @@ button, input, select, textarea {
}
.btn:hover {
background-color: var(--ui-hover);
background-color: var(--ansi-12);
border-color: var(--app-fg);
}
@ -164,6 +182,7 @@ button, input, select, textarea {
}
.btn-primary:hover {
background-color: var(--btn-primary-bg);
box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}
@ -174,6 +193,7 @@ button, input, select, textarea {
}
.btn-danger:hover {
background-color: var(--btn-danger-bg);
box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}
@ -207,13 +227,15 @@ button, input, select, textarea {
color: var(--app-bg);
font-size: 13px;
font-weight: 500;
flex-shrink: 0;
}
/* App Body */
.app-body {
display: grid;
grid-template-columns: 280px 1fr 1fr;
height: calc(100vh - 32px - 44px - 24px);
flex: 1;
min-height: 0;
overflow: hidden;
}
@ -482,6 +504,7 @@ button, input, select, textarea {
border-top: 1px solid var(--ui-border);
font-size: 11px;
opacity: 0.8;
flex-shrink: 0;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
@ -489,7 +512,7 @@ button, input, select, textarea {
.about-page {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
}
.about-page main {
@ -498,27 +521,237 @@ button, input, select, textarea {
max-width: 720px;
}
/* Mobile Tab Bar — hidden on desktop */
.tab-bar {
display: none;
}
/* Responsive */
@media (max-width: 900px) {
.app-body {
grid-template-columns: 220px 1fr 1fr;
grid-template-columns: 240px 1fr 1fr;
}
}
@media (max-width: 700px) {
/* Mobile: <= 600px (covers iPhone 11 at 390px CSS width) */
@media (max-width: 600px) {
html, body {
height: 100%;
overscroll-behavior: none;
}
body {
height: 100dvh;
}
/* Menu bar wraps to a second row.
NOTE: do not use `overflow: auto` here — it would create a new stacking
context and trap the absolutely-positioned `.menu-dropdown` underneath
the toolbar and content panes. */
.menu-bar {
height: auto;
min-height: 40px;
padding: 0 8px;
flex-shrink: 0;
}
.menu-list {
flex-wrap: wrap;
overflow: visible;
}
.menu-item {
padding: 8px 10px;
min-height: 40px;
display: flex;
align-items: center;
white-space: nowrap;
font-size: 14px;
}
/* Constrain the dropdown to the viewport width and a conservative height
on phones. Safe to use `overflow` here: it only clips the dropdown's own
contents, it does not trap the dropdown inside an ancestor's context. */
.menu-dropdown {
max-width: calc(100vw - 16px);
max-height: 55dvh;
}
.app-title {
display: none;
}
/* Toolbar wraps instead of stretching off-screen */
.toolbar {
flex-wrap: wrap;
height: auto;
padding: 8px;
gap: 8px;
flex-shrink: 0;
}
.toolbar-group {
flex: 1 1 auto;
min-width: 0;
}
.search-form {
flex: 1 1 100%;
min-width: 0;
display: flex;
}
.search-form input {
flex: 1;
width: 100%;
min-width: 0;
}
.theme-form {
flex: 1 1 auto;
min-width: 0;
}
.theme-form select {
flex: 1;
min-width: 0;
}
/* Apple HIG minimum 44px touch targets */
.btn {
min-height: 44px;
padding: 10px 14px;
font-size: 15px;
flex-shrink: 0;
}
.search-form input,
.theme-form select {
min-height: 44px;
padding: 10px 12px;
font-size: 16px; /* prevents iOS zoom-on-focus */
}
/* Tab bar replaces the 3-column layout on mobile */
.tab-bar {
display: flex;
flex-shrink: 0;
background-color: var(--app-bg);
border-bottom: 1px solid var(--ui-border);
padding: 4px 8px;
gap: 4px;
transition: background-color 0.15s ease, border-color 0.15s ease;
}
.tab-button {
flex: 1;
min-height: 48px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2px;
padding: 6px 4px;
background: none;
border: none;
border-radius: 8px;
color: var(--app-fg);
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.15s ease, color 0.15s ease;
}
.tab-button.active {
background-color: var(--ui-hover);
}
.tab-icon {
font-size: 18px;
line-height: 1;
}
/* Single-pane view: only the active tab's pane is displayed */
.app-body {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
display: block;
flex: 1;
min-height: 0;
overflow: hidden;
}
.sidebar {
.app-body > * {
display: none;
height: 100%;
border-right: none;
border-bottom: 1px solid var(--ui-border);
max-height: 200px;
border-bottom: none;
-webkit-overflow-scrolling: touch;
}
.editor-pane {
border-right: none;
border-bottom: 1px solid var(--ui-border);
.app-body > .mobile-active {
display: flex;
flex-direction: column;
}
/* Sidebar fills the pane on mobile */
.sidebar-header {
padding: 12px 16px;
}
.note-list {
padding: 8px;
}
.note-item a {
padding: 14px 12px;
}
/* Editor fills the pane on mobile */
.note-title-input {
font-size: 18px;
padding: 14px 16px;
flex-shrink: 0;
}
.note-content-input {
font-size: 16px; /* prevents iOS zoom-on-focus */
padding: 16px;
}
.form-actions {
padding: 12px 16px;
flex-shrink: 0;
}
.form-actions .btn {
width: 100%;
}
/* Preview fills the pane on mobile */
.markdown-body {
padding: 20px 16px;
font-size: 16px;
}
/* Status bar stays compact */
.status-bar {
height: 28px;
flex-shrink: 0;
gap: 10px;
font-size: 11px;
overflow-x: auto;
scrollbar-width: none;
}
.status-bar::-webkit-scrollbar {
display: none;
}
/* Prevent horizontal page scroll */
.flash-message {
flex-shrink: 0;
}
.about-page main {
padding: 24px 16px;
}
}