Skip to content

Commit 28a27f9

Browse files
committed
Optimize the visual presentation of tables
1 parent 0af5346 commit 28a27f9

2 files changed

Lines changed: 127 additions & 3 deletions

File tree

src/components/Preview.css

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,3 +1487,127 @@ img[data-clickable-image="true"]:hover {
14871487
.hljs {
14881488
background: transparent !important;
14891489
}
1490+
1491+
/* Table styles */
1492+
.desktop-preview table,
1493+
.phone-content table,
1494+
.card-preview-card table {
1495+
border-collapse: separate;
1496+
border-spacing: 0;
1497+
overflow: hidden;
1498+
}
1499+
1500+
/* Table header */
1501+
.desktop-preview th,
1502+
.phone-content th,
1503+
.card-preview-card th {
1504+
position: relative;
1505+
transition: background 0.2s ease;
1506+
}
1507+
1508+
/* Table row hover effect - 简约淡雅 */
1509+
.desktop-preview tbody tr,
1510+
.phone-content tbody tr,
1511+
.card-preview-card tbody tr {
1512+
transition: background-color 0.2s ease;
1513+
}
1514+
1515+
.desktop-preview tbody tr:hover,
1516+
.phone-content tbody tr:hover,
1517+
.card-preview-card tbody tr:hover {
1518+
background-color: #f8fafc !important;
1519+
}
1520+
1521+
.desktop-preview tbody tr:hover td,
1522+
.phone-content tbody tr:hover td,
1523+
.card-preview-card tbody tr:hover td {
1524+
background-color: #f8fafc !important;
1525+
}
1526+
1527+
/* Striped rows - 极淡的蓝色 */
1528+
.desktop-preview tbody tr:nth-child(even) td,
1529+
.phone-content tbody tr:nth-child(even) td,
1530+
.card-preview-card tbody tr:nth-child(even) td {
1531+
background-color: #f8fafc !important;
1532+
}
1533+
1534+
.desktop-preview tbody tr:nth-child(odd) td,
1535+
.phone-content tbody tr:nth-child(odd) td,
1536+
.card-preview-card tbody tr:nth-child(odd) td {
1537+
background-color: #ffffff !important;
1538+
}
1539+
1540+
/* Remove border from last row */
1541+
.desktop-preview tbody tr:last-child td,
1542+
.phone-content tbody tr:last-child td,
1543+
.card-preview-card tbody tr:last-child td {
1544+
border-bottom: none;
1545+
}
1546+
1547+
/* First and last cell border radius */
1548+
.desktop-preview thead tr:first-child th:first-child,
1549+
.phone-content thead tr:first-child th:first-child,
1550+
.card-preview-card thead tr:first-child th:first-child {
1551+
border-top-left-radius: 6px;
1552+
}
1553+
1554+
.desktop-preview thead tr:first-child th:last-child,
1555+
.phone-content thead tr:first-child th:last-child,
1556+
.card-preview-card thead tr:first-child th:last-child {
1557+
border-top-right-radius: 6px;
1558+
}
1559+
1560+
.desktop-preview tbody tr:last-child td:first-child,
1561+
.phone-content tbody tr:last-child td:first-child,
1562+
.card-preview-card tbody tr:last-child td:first-child {
1563+
border-bottom-left-radius: 6px;
1564+
}
1565+
1566+
.desktop-preview tbody tr:last-child td:last-child,
1567+
.phone-content tbody tr:last-child td:last-child,
1568+
.card-preview-card tbody tr:last-child td:last-child {
1569+
border-bottom-right-radius: 6px;
1570+
}
1571+
1572+
/* Dark theme table styles - 低调深蓝 */
1573+
.preview-panel:not(.light) .desktop-preview table,
1574+
.preview-panel:not(.light) .phone-content table {
1575+
border-color: #334155;
1576+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
1577+
}
1578+
1579+
.preview-panel:not(.light) .desktop-preview th,
1580+
.preview-panel:not(.light) .phone-content th {
1581+
background: #1e293b !important;
1582+
color: #cbd5e1 !important;
1583+
border-bottom-color: #334155 !important;
1584+
}
1585+
1586+
.preview-panel:not(.light) .desktop-preview td,
1587+
.preview-panel:not(.light) .phone-content td {
1588+
color: #cbd5e1 !important;
1589+
border-bottom-color: #334155 !important;
1590+
}
1591+
1592+
.preview-panel:not(.light) .desktop-preview tbody tr:nth-child(even) td,
1593+
.preview-panel:not(.light) .phone-content tbody tr:nth-child(even) td {
1594+
background-color: #1e293b !important;
1595+
}
1596+
1597+
.preview-panel:not(.light) .desktop-preview tbody tr:nth-child(odd) td,
1598+
.preview-panel:not(.light) .phone-content tbody tr:nth-child(odd) td {
1599+
background-color: #0f172a !important;
1600+
}
1601+
1602+
.preview-panel:not(.light) .desktop-preview tbody tr:hover,
1603+
.preview-panel:not(.light) .phone-content tbody tr:hover {
1604+
background-color: #1e293b !important;
1605+
}
1606+
1607+
.preview-panel:not(.light) .desktop-preview tbody tr:hover td,
1608+
.preview-panel:not(.light) .phone-content tbody tr:hover td {
1609+
background-color: #1e293b !important;
1610+
}
1611+
1612+
1613+

src/components/Preview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ const defaultStyles = {
5555
li: 'margin-bottom: 8px; margin-top: 4px; line-height: 1.8;',
5656
a: 'color: #576b95; text-decoration: none;',
5757
img: 'max-width: 100%; height: auto; border-radius: 8px; margin: 14px auto; display: block; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);',
58-
table: 'border-collapse: collapse; width: 100%; margin-bottom: 14px; font-size: 14px;',
59-
th: 'border: 1px solid #e0e0e0; padding: 6px 10px; text-align: left; color: #333; background: #f5f5f5; font-weight: 600;',
60-
td: 'border: 1px solid #e0e0e0; padding: 6px 10px; text-align: left; color: #333;',
58+
table: 'border-collapse: separate; border-spacing: 0; width: 100%; margin: 20px 0; font-size: 14px; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(59, 130, 246, 0.05); border: 1px solid #e0f2fe;',
59+
th: 'border-bottom: 1px solid #bfdbfe; padding: 10px 14px; text-align: left; color: #475569; background: #f8fafc; font-weight: 600; font-size: 13px;',
60+
td: 'border-bottom: 1px solid #f1f5f9; padding: 9px 14px; text-align: left; color: #334155; background: #ffffff;',
6161
hr: 'border: none; border-top: 1px solid #e0e0e0; margin: 20px 0;',
6262
strong: 'font-weight: bold; display: inline; margin: 0; padding: 0; color: #1890ff;',
6363
em: 'font-style: italic; display: inline; margin: 0; padding: 0;'

0 commit comments

Comments
 (0)