示例工程 14-react-bootstrap
14-react-bootstrap/app/src/styles.css
:root {
--bg: #ffffff;
--panel: #f8fafc;
--border: #e2e8f0;
--text: #0f172a;
--muted: #64748b;
--accent: #2563eb;
font-family:
system-ui,
-apple-system,
"PingFang SC",
"Microsoft YaHei",
sans-serif;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-size: 14px;
line-height: 1.6;
}
#app {
max-width: 920px;
margin: 0 auto;
padding: 28px 32px 40px;
}
.header {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
border-bottom: 1px solid var(--border);
padding-bottom: 16px;
}
h1 {
margin: 0;
font-size: 24px;
letter-spacing: -0.01em;
}
.subtitle {
margin: 6px 0 0;
color: var(--muted);
font-size: 13px;
}
.tabs {
display: flex;
gap: 4px;
}
.tab {
border: 1px solid transparent;
background: transparent;
color: var(--muted);
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
cursor: pointer;
}
.tab:hover {
background: var(--panel);
}
.tab.active {
color: var(--accent);
border-color: var(--border);
background: var(--panel);
font-weight: 600;
}
.content {
padding-top: 22px;
}
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
.card {
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
background: var(--panel);
}
.card-label {
color: var(--muted);
font-size: 12px;
}
.card-value {
margin-top: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 15px;
font-weight: 600;
}
.section {
margin-top: 26px;
}
h2 {
font-size: 16px;
margin: 0 0 10px;
}
.layers {
display: grid;
gap: 8px;
}
.layer {
display: flex;
gap: 12px;
border-left: 3px solid var(--accent);
background: var(--panel);
padding: 10px 12px;
border-radius: 0 6px 6px 0;
}
.layer strong {
min-width: 84px;
}
.layer span {
color: var(--muted);
}
.table {
width: 100%;
border-collapse: collapse;
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.table th,
.table td {
text-align: left;
padding: 9px 12px;
border-bottom: 1px solid var(--border);
}
.table th {
background: var(--panel);
color: var(--muted);
font-weight: 600;
font-size: 12px;
}
.table tr:last-child td {
border-bottom: none;
}
code {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 4px;
padding: 1px 4px;
}
.hint {
color: var(--muted);
font-size: 12px;
margin-top: 10px;
}
.toolbar {
display: flex;
align-items: center;
gap: 8px;
margin-top: 16px;
}
.toolbar .hint {
margin: 0 0 0 auto;
max-width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.actions {
display: flex;
gap: 6px;
}
.mini {
border: 1px solid var(--border);
background: #ffffff;
color: var(--text);
border-radius: 5px;
padding: 3px 8px;
font-size: 12px;
cursor: pointer;
}
.mini:hover:not(:disabled) {
border-color: var(--accent);
color: var(--accent);
}
.mini.danger:hover {
border-color: #dc2626;
color: #dc2626;
}
.mini:disabled {
color: var(--muted);
cursor: not-allowed;
opacity: 0.7;
}
.error {
margin: 12px 0 0;
padding: 8px 12px;
border: 1px solid #fecaca;
background: #fef2f2;
color: #b91c1c;
border-radius: 6px;
font-size: 13px;
}
.row {
display: flex;
align-items: center;
gap: 8px;
margin: 12px 0;
}
input {
border: 1px solid var(--border);
border-radius: 6px;
padding: 6px 10px;
font: inherit;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
width: 220px;
color: var(--text);
background: #ffffff;
}
input:focus {
outline: 2px solid var(--accent);
outline-offset: -1px;
}
.panel {
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px 14px;
margin-top: 12px;
background: var(--panel);
}
.panel-label {
color: var(--muted);
font-size: 12px;
margin-bottom: 6px;
}
.value {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 22px;
font-weight: 600;
color: var(--accent);
}
.value.danger {
color: #b91c1c;
font-size: 14px;
font-weight: 500;
}
.stack {
margin: 0;
white-space: normal;
word-break: break-word;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.55;
color: #7f1d1d;
}
.badge {
border: 1px solid var(--border);
background: #ffffff;
border-radius: 999px;
padding: 2px 10px;
font-size: 12px;
color: var(--muted);
}
.tabs .tab {
white-space: nowrap;
}
.frames {
margin: 8px 0 0;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.55;
color: var(--muted);
white-space: pre-wrap;
word-break: break-word;
}
.form {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 10px;
margin: 12px 0;
}
.form label {
display: flex;
flex-direction: column;
gap: 4px;
color: var(--muted);
font-size: 12px;
}
.form input {
width: 100%;
}
.code {
margin: 0;
white-space: pre-wrap;
word-break: break-word;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.55;
color: var(--text);
}
.card-value.small {
font-size: 12px;
font-weight: 500;
word-break: break-all;
}
.mini {
border: 1px solid var(--border);
background: #ffffff;
color: var(--text);
border-radius: 5px;
padding: 5px 9px;
font-size: 12px;
cursor: pointer;
}
.mini:hover {
border-color: var(--accent);
color: var(--accent);
}
.code {
max-height: 300px;
overflow: auto;
}
.progress {
height: 10px;
border-radius: 999px;
background: #e2e8f0;
overflow: hidden;
margin: 14px 0 16px;
}
.bar {
height: 100%;
background: var(--accent);
transition: width 120ms linear;
}
.summary {
margin-top: 6px;
}
.grid.summary {
grid-template-columns: repeat(4, 1fr);
}
textarea {
width: 100%;
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 10px;
font: inherit;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
line-height: 1.55;
color: var(--text);
background: #ffffff;
resize: vertical;
}
textarea:focus {
outline: 2px solid var(--accent);
outline-offset: -1px;
}
.service-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin: 14px 0;
}
.service-card {
min-height: 220px;
}
.mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 12px;
color: var(--muted);
margin-top: 4px;
}
.method-list {
margin: 10px 0;
padding-left: 18px;
}
.method-list li {
margin: 4px 0;
font-size: 12px;
}
@media (max-width: 860px) {
.service-grid {
grid-template-columns: 1fr;
}
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin: 14px 0;
}
.danger-panel {
border-color: #fecaca;
background: #fef2f2;
}
.key-list,
.method-list {
margin: 8px 0;
padding-left: 18px;
}
.key-list li,
.method-list li {
margin: 4px 0;
font-size: 12px;
}
.secret {
color: #b91c1c;
border: 1px solid #fecaca;
background: #ffffff;
border-radius: 999px;
padding: 0 6px;
font-size: 11px;
}
@media (max-width: 860px) {
.two-col {
grid-template-columns: 1fr;
}
}
.explorer {
display: grid;
grid-template-columns: 300px 1fr;
gap: 16px;
margin-top: 16px;
}
.tree {
border: 1px solid var(--border);
border-radius: 8px;
background: var(--panel);
padding: 10px 0;
min-height: 520px;
max-height: 560px;
overflow: auto;
}
.tree-title {
padding: 0 12px 8px;
color: var(--muted);
font-size: 12px;
border-bottom: 1px solid var(--border);
margin-bottom: 6px;
}
.tree-row {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
border: none;
background: transparent;
text-align: left;
padding: 5px 10px;
font-size: 13px;
color: var(--text);
cursor: default;
}
.tree-row.file {
cursor: pointer;
}
.tree-row.file:hover,
.tree-row.file.active {
background: #eff6ff;
color: var(--accent);
}
.tree-row .icon {
color: var(--muted);
width: 10px;
}
.tree-row .size {
margin-left: auto;
color: var(--muted);
font-size: 11px;
}
.editor textarea {
min-height: 420px;
}
@media (max-width: 880px) {
.explorer {
grid-template-columns: 1fr;
}
.tree {
min-height: 200px;
max-height: 260px;
}
}
#root {
max-width: 1100px;
margin: 0 auto;
padding: 28px 32px 40px;
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.tree-code {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
line-height: 1.7;
}
@media (max-width: 860px) {
.two-col {
grid-template-columns: 1fr;
}
}