refactor: extract global styles and tokens (Task 2.1)

- Create styles/tokens.css with CSS custom properties and dark theme
- Create styles/global.css with resets, shell layout, and navigation
- Create styles/utilities.css with generic utilities and primitives
- Create styles/syntax-highlight.css with Prism.js theme
- Update main.tsx to import the 4 new style files
- Keep styles.css intact for backward compatibility

Quality gates: build (pass), lint (pass)
Refs: repo-restructure Task 2.1
This commit is contained in:
Developer
2026-06-02 19:29:38 +00:00
parent c50d6663d5
commit c5fbb6722b
17 changed files with 1750 additions and 47 deletions
+4 -1
View File
@@ -5,7 +5,10 @@ import { BrowserRouter } from "react-router-dom";
import { AppRouter } from "./router";
import { AuthProvider } from "./state/auth";
import { SessionsProvider } from "./state/sessions";
import "./styles.css";
import "./styles/tokens.css";
import "./styles/global.css";
import "./styles/utilities.css";
import "./styles/syntax-highlight.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
+127
View File
@@ -0,0 +1,127 @@
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--ink);
}
[data-theme="dark"] body {
background: radial-gradient(circle at top right, #2a2520, var(--bg));
}
a {
color: inherit;
text-decoration: none;
}
.shell {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.shell-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.85rem 1.25rem;
border-bottom: 1px solid var(--border);
background: color-mix(in srgb, var(--panel) 88%, transparent);
backdrop-filter: blur(7px);
}
[data-theme="dark"] .shell-header {
background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.brand {
font-weight: 700;
letter-spacing: 0.02em;
}
.header-actions {
display: flex;
align-items: center;
gap: 0.75rem;
}
.shell-body {
display: grid;
grid-template-columns: 230px 1fr;
min-height: calc(100vh - 57px);
}
.shell-nav {
border-right: 1px solid var(--border);
padding: 1rem 0.75rem;
display: flex;
flex-direction: column;
gap: 0.4rem;
background: color-mix(in srgb, var(--panel) 65%, transparent);
}
.nav-item {
padding: 0.65rem 0.75rem;
border-radius: 10px;
color: var(--muted);
}
.nav-item:hover {
background: #ece7df;
color: var(--ink);
}
.nav-item-active {
background: var(--brand);
color: #f7fff7;
}
.nav-section-title {
margin-top: 0.5rem;
padding: 0.25rem 0.75rem;
font-size: var(--font-size-xs);
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
.nav-divider {
height: 1px;
background: var(--border);
margin: 0.5rem 0;
}
.shell-content {
/* Responsive Shell */
@media (max-width: 767px) {
.shell-body {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
}
.shell-nav {
flex-direction: row;
flex-wrap: wrap;
gap: 0.25rem;
padding: 0.5rem;
border-right: none;
border-bottom: 1px solid var(--border);
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.nav-item {
padding: 0.5rem 0.75rem;
white-space: nowrap;
font-size: var(--font-size-sm);
}
.shell-content {
padding: var(--space-4);
}
}
.stack {
+131
View File
@@ -0,0 +1,131 @@
/* Prism.js Theme Integration */
code[class*="language-"],
pre[class*="language-"] {
color: var(--ink);
text-shadow: none;
font-family: 'Fira Code', 'Monaco', 'Courier New', monospace;
font-size: 14px;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
tab-size: 2;
hyphens: none;
}
/* Syntax Highlighting Colors */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: var(--muted);
}
.token.punctuation {
color: var(--ink);
}
.token.namespace {
opacity: 0.7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #f59e0b;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #10b981;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #f43f5e;
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #3b82f6;
}
.token.function,
.token.class-name {
color: #8b5cf6;
}
.token.regex,
.token.important,
.token.variable {
color: #ec4899;
}
/* Icon System */
.icon {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
vertical-align: middle;
}
.icon svg {
display: block;
}
.icon-sm {
width: 16px;
height: 16px;
}
.icon-md {
width: 20px;
height: 20px;
}
.icon-lg {
width: 24px;
height: 24px;
}
.icon-xl {
width: 32px;
height: 32px;
}
/* Button icons */
button .icon,
a .icon {
margin-right: 0.35rem;
}
button .icon:last-child,
a .icon:last-child {
margin-right: 0;
}
/* Navigation icons */
.nav-item .icon {
margin-right: 0.5rem;
}
/* Status badge icons */
.status-badge .icon {
margin-right: 0.25rem;
}
+69
View File
@@ -0,0 +1,69 @@
:root {
color-scheme: light;
font-family: "Inter", "IBM Plex Sans", "Segoe UI", sans-serif;
--bg: #f4f1ea;
--panel: #fffef9;
--ink: #1d1d1b;
--muted: #5f5b55;
--brand: #275d4b;
--brand-strong: #154236;
--border: #d8d0c5;
--primary: #275d4b;
--primary-fg: #fffef9;
--color-primary: #275d4b;
--success: #2f8f62;
--success-light: rgba(47, 143, 98, 0.14);
--warning: #c08a1e;
--warning-light: rgba(192, 138, 30, 0.14);
--danger: #b94a3c;
--danger-light: rgba(185, 74, 60, 0.14);
--info: #4f7fb8;
--info-light: rgba(79, 127, 184, 0.14);
/* Spacing Scale (4px base) */
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-5: 1.5rem;
--space-6: 2rem;
--space-8: 3rem;
--space-10: 4rem;
/* Breakpoints */
--bp-sm: 480px;
--bp-md: 768px;
--bp-lg: 1024px;
--bp-xl: 1280px;
/* Fluid Typography */
--font-size-xs: clamp(0.625rem, 0.6rem + 0.125vw, 0.75rem);
--font-size-sm: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
--font-size-base: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
--font-size-lg: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
--font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
--font-size-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
}
[data-theme="dark"] {
color-scheme: dark;
--bg: #171613;
--panel: #22201d;
--ink: #ece7df;
--muted: #a59d92;
--brand: #5fa889;
--brand-strong: #4d9175;
--border: #39342d;
--primary: #5fa889;
--primary-fg: #171613;
--color-primary: #5fa889;
--success: #22c55e;
--success-light: rgba(34, 197, 94, 0.15);
--warning: #f59e0b;
--warning-light: rgba(245, 158, 11, 0.15);
--danger: #ef4444;
--danger-light: rgba(239, 68, 68, 0.15);
--info: #3b82f6;
--info-light: rgba(59, 130, 246, 0.15);
}
+718
View File
@@ -0,0 +1,718 @@
flex-direction: column;
gap: 1rem;
}
.muted {
color: var(--muted);
}
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
gap: var(--space-4);
}
@media (min-width: 768px) {
.card-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (min-width: 1024px) {
.card-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
.card {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 14px;
padding: 1rem;
}
.card-label {
margin: 0;
color: var(--muted);
}
.card-value {
margin: 0.45rem 0 0;
font-size: 1.6rem;
font-weight: 700;
}
.quick-actions {
display: flex;
gap: 0.6rem;
}
.primary-button,
.secondary-button,
.ghost-button {
border-radius: 10px;
border: 1px solid transparent;
padding: 0.58rem 0.85rem;
cursor: pointer;
font: inherit;
}
.primary-button {
background: var(--brand);
color: white;
}
.primary-button:hover {
background: var(--brand-strong);
}
.secondary-button {
border-color: var(--border);
background: var(--panel);
}
.ghost-button {
border-color: var(--border);
background: transparent;
}
.user-chip {
border: 1px solid var(--border);
background: var(--panel);
border-radius: 999px;
padding: 0.35rem 0.7rem;
font-size: 0.9rem;
}
.center-screen {
min-height: 55vh;
display: grid;
place-content: center;
text-align: center;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: var(--space-3);
}
@media (max-width: 767px) {
.page-header {
flex-direction: column;
align-items: flex-start;
}
}
.project-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.project-card {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
}
.project-info h3 {
margin: 0 0 0.35rem;
}
.project-info p {
margin: 0;
}
.project-actions {
display: flex;
gap: 0.5rem;
align-items: center;
flex-shrink: 0;
}
.delete-confirm {
display: flex;
gap: 0.5rem;
align-items: center;
}
.danger-button {
border-radius: 10px;
border: 1px solid transparent;
padding: 0.58rem 0.85rem;
cursor: pointer;
font: inherit;
background: #b91c1c;
color: white;
}
.danger-text {
color: #b91c1c;
}
.error-text {
color: #b91c1c;
margin: 0;
}
.dialog-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.35);
display: grid;
place-content: center;
z-index: 50;
}
.dialog {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 14px;
padding: var(--space-5);
width: min(560px, 100vw - 2rem);
max-height: min(800px, 100vh - 2rem);
overflow-y: auto;
}
.dialog-lg {
width: min(800px, 100vw - 2rem);
}
@media (max-width: 767px) {
.dialog {
width: 100vw;
height: 100vh;
max-height: 100vh;
border-radius: 0;
padding: var(--space-4);
}
.dialog-overlay {
padding: 0;
}
}
.dialog h2 {
margin: 0 0 1rem;
}
.form-field {
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.form-field input,
.form-field textarea,
.form-field select {
padding: 0.55rem 0.7rem;
border: 1px solid var(--border);
border-radius: 10px;
font: inherit;
background: var(--panel);
color: var(--ink);
}
.dialog-actions {
display: flex;
justify-content: flex-end;
gap: 0.6rem;
}
.keys-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.key-card {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 14px;
padding: 1rem;
}
.key-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.key-header h3 {
margin: 0;
}
.key-meta {
margin-bottom: 0.75rem;
}
.key-public {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem;
background: #f5f3ee;
border-radius: 8px;
}
.key-public code {
font-size: 0.85rem;
word-break: break-all;
flex: 1;
}
flex-direction: column;
gap: 0.35rem;
}
.form-group input {
padding: 0.55rem 0.7rem;
border: 1px solid var(--border);
border-radius: 10px;
font: inherit;
}
.error {
color: #b91c1c;
padding: 0.75rem;
background: #fef2f2;
border-radius: 10px;
}
@media (max-width: 860px) {
.shell-body {
grid-template-columns: 1fr;
}
.shell-nav {
flex-direction: row;
overflow-x: auto;
border-right: 0;
border-bottom: 1px solid var(--border);
}
.card-grid {
grid-template-columns: 1fr;
}
.quick-actions {
flex-direction: column;
}
.project-card {
flex-direction: column;
}
}
/* URL Validation Styles */
.valid-url {
border-color: var(--success, #16a34a) !important;
background-color: var(--success-light, #f0fdf4) !important;
}
/* ============================================
Responsive Design System
============================================ */
/* Layout Utilities */
.container {
width: 100%;
max-width: min(1200px, 100vw - 2rem);
margin-inline: auto;
padding-inline: var(--space-4);
}
.stack {
display: flex;
flex-direction: column;
gap: var(--space-4);
}
.stack-sm {
gap: var(--space-2);
}
.stack-md {
gap: var(--space-4);
}
.stack-lg {
gap: var(--space-6);
}
.row {
display: flex;
flex-wrap: wrap;
gap: var(--space-4);
align-items: center;
}
.grid {
display: grid;
gap: var(--space-4);
grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
/* Text Utilities */
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.truncate-multiline {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.break-word {
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
}
/* Touch Targets */
.button,
.nav-link,
.icon-button,
button,
[role="button"] {
min-height: 44px;
min-width: 44px;
}
/* Dialog Responsive */
.dialog {
width: min(560px, 100vw - 2rem);
max-height: min(800px, 100vh - 2rem);
overflow-y: auto;
}
.dialog-lg {
width: min(800px, 100vw - 2rem);
}
/* Table Responsive */
.table-responsive {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.table-responsive table {
min-width: 100%;
}
/* Mobile-first Media Queries */
@media (max-width: 767px) {
/* Card layout for tables on mobile */
.table-responsive thead {
display: none;
}
.table-responsive tbody tr {
display: block;
margin-bottom: var(--space-4);
border: 1px solid var(--border);
border-radius: 8px;
padding: var(--space-4);
}
.table-responsive td {
display: flex;
justify-content: space-between;
padding: var(--space-2) 0;
border-bottom: 1px solid var(--border);
}
.table-responsive td:last-child {
border-bottom: none;
}
.table-responsive td::before {
content: attr(data-label);
font-weight: 600;
margin-right: var(--space-2);
}
/* Larger touch targets on mobile */
.button,
button {
padding: var(--space-3) var(--space-4);
}
/* Full-width inputs on mobile */
input,
select,
textarea {
width: 100%;
min-height: 44px;
}
}
/* Small devices */
@media (min-width: 480px) {
.container {
padding-inline: var(--space-5);
}
}
/* Medium devices */
@media (min-width: 768px) {
.container {
padding-inline: var(--space-6);
}
}
/* Large devices */
@media (min-width: 1024px) {
.container {
padding-inline: var(--space-8);
}
}
/* Extra large devices */
@media (min-width: 1280px) {
.container {
max-width: 1200px;
}
}
/* ============================================
Page-Specific Responsive Styles
============================================ */
/* Forms - Full width on mobile */
@media (max-width: 767px) {
.form-field input,
.form-field textarea,
.form-field select {
width: 100%;
min-height: 44px;
}
/* Settings page stack */
.settings-layout {
flex-direction: column;
}
.settings-nav {
flex-direction: row;
overflow-x: auto;
padding-bottom: var(--space-2);
}
/* Project cards full width */
.project-card {
flex-direction: column;
gap: var(--space-3);
}
.project-actions {
width: 100%;
justify-content: flex-start;
}
/* Repository cards */
.repository-card {
flex-direction: column;
gap: var(--space-3);
align-items: flex-start;
}
.repository-actions {
width: 100%;
justify-content: flex-start;
}
/* Git toolbar wrap */
.git-toolbar {
flex-wrap: wrap;
gap: var(--space-2);
}
/* Dashboard cards */
.dashboard-grid {
grid-template-columns: 1fr;
}
/* Stack form actions */
.form-actions {
flex-direction: column;
width: 100%;
}
.form-actions button {
width: 100%;
justify-content: center;
}
}
/* Ensure all pages have proper padding */
.stack > h1,
.stack > h2 {
margin-top: 0;
}
/* Touch target verification override */
button,
[role="button"],
a.nav-item,
.tree-entry {
min-height: 44px;
}
/* Table horizontal scroll wrapper */
.table-wrapper {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
width: 100%;
}
/* Dialog content spacing */
.dialog-body {
padding: var(--space-4) 0;
}
/* Prevent text overflow in cards */
.card h3,
.card p {
overflow: hidden;
text-overflow: ellipsis;
}
/* SSH keys table responsive */
.ssh-key-list {
display: flex;
flex-direction: column;
gap: var(--space-3);
}
.ssh-key-item {
display: flex;
flex-direction: column;
gap: var(--space-2);
padding: var(--space-4);
background: var(--bg);
border: 1px solid var(--border);
border-radius: 10px;
}
@media (min-width: 768px) {
.ssh-key-item {
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
/* Session Navigation */
.session-item {
position: relative;
padding-left: var(--space-6);
}
.session-status {
position: absolute;
left: var(--space-2);
top: 50%;
transform: translateY(-50%);
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--muted);
}
.session-status.running {
background: var(--success);
}
.session-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 140px;
}
.nav-divider {
height: 1px;
background: var(--border);
margin: var(--space-2) var(--space-3);
}
.nav-section-title {
padding: var(--space-2) var(--space-4);
font-size: var(--text-xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--muted);
}
/* Instance List */
.instance-list {
margin-top: var(--space-4);
}
.instance-list-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--space-4);
}
.instance-list-header h3 {
margin: 0;
}
.instance-grid {
display: grid;
gap: var(--space-3);
}
.instance-card {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--space-4);
background: var(--bg);
border: 1px solid var(--border);
border-radius: 10px;
}
.instance-info {
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.instance-name {
font-weight: 600;
}
.instance-meta {
display: flex;
align-items: center;
gap: var(--space-2);
font-size: var(--text-sm);
color: var(--muted);
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.instance-actions {
display: flex;
gap: var(--space-2);
align-items: center;
}
/* ============================================