Skip to content

Commit 40d8580

Browse files
committed
add border radius to in-content tables
1 parent efc4e95 commit 40d8580

2 files changed

Lines changed: 69 additions & 2 deletions

File tree

website/src/css/customTheme.scss

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
--deepdark: #20232a;
1414
--light: #373940;
1515
--text: #1a1a1a;
16-
--subtle: #636363;
16+
--subtle: #6c707b;
1717
--divider: #ececec;
1818
--tintColor: #f7f7f7;
1919

@@ -46,6 +46,8 @@
4646
--ifm-toc-link-color: var(--ifm-color-emphasis-700);
4747
--ifm-blockquote-color: var(--ifm-font-color-base);
4848
--ifm-blockquote-font-size: 16px;
49+
--ifm-global-radius: 9px;
50+
--ifm-code-border-radius: 0.4rem;
4951
--ifm-blockquote-border-radius: var(--ifm-global-radius);
5052
--ifm-table-head-color: var(--subtle);
5153
--ifm-link-hover-decoration: none;
@@ -61,6 +63,7 @@
6163
--ifm-table-border-color: var(--ifm-toc-border-color);
6264
--ifm-table-cell-padding: 10px;
6365
--ifm-table-stripe-background: rgba(0, 0, 0, 0.02);
66+
--ifm-table-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
6467
--ifm-alert-border-radius: 20px;
6568

6669
@media (min-width: 340px) {
@@ -120,7 +123,7 @@ html[data-theme="light"] {
120123
}
121124

122125
html[data-theme="dark"] {
123-
--subtle: #7c7c7c;
126+
--subtle: #858993;
124127

125128
--navbar-background: #20232aee;
126129
--sidebar-active-item-background: #61dafb15;
@@ -130,6 +133,8 @@ html[data-theme="dark"] {
130133
--ifm-color-emphasis-300: var(--dark);
131134
--ifm-table-head-background: var(--deepdark);
132135
--ifm-table-head-color: var(--subtle);
136+
--ifm-table-stripe-background: rgba(0, 0, 0, 0.08);
137+
--ifm-table-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
133138

134139
--docsearch-searchbox-background: var(--ifm-background-color);
135140
--docsearch-modal-background: var(--deepdark);
@@ -352,10 +357,19 @@ hr {
352357
font-weight: 600;
353358
}
354359

360+
.table-wrapper {
361+
border: 1px solid var(--ifm-table-border-color);
362+
border-radius: var(--ifm-global-radius);
363+
overflow: hidden;
364+
box-shadow: var(--ifm-table-box-shadow);
365+
margin-bottom: var(--ifm-spacing-vertical);
366+
}
367+
355368
table {
356369
display: table;
357370
width: 100%;
358371
table-layout: fixed;
372+
margin-bottom: 0;
359373

360374
thead tr {
361375
border: 0;
@@ -365,12 +379,24 @@ hr {
365379
padding: 6px var(--ifm-table-cell-padding);
366380
font-size: 80%;
367381
text-align: start;
382+
border: 0;
383+
border-right: 1px solid var(--ifm-table-border-color);
384+
385+
&:last-child {
386+
border-right: 0;
387+
}
368388
}
369389

370390
tr td {
371391
font-size: 90%;
372392
line-height: 1.3em;
373393
text-align: start;
394+
border: 0;
395+
border-right: 1px solid var(--ifm-table-border-color);
396+
397+
&:last-child {
398+
border-right: 0;
399+
}
374400

375401
code {
376402
display: inline-block;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React, {type ComponentProps} from 'react';
2+
import Head from '@docusaurus/Head';
3+
import MDXCode from '@theme/MDXComponents/Code';
4+
import MDXA from '@theme/MDXComponents/A';
5+
import MDXPre from '@theme/MDXComponents/Pre';
6+
import MDXDetails from '@theme/MDXComponents/Details';
7+
import MDXHeading from '@theme/MDXComponents/Heading';
8+
import MDXUl from '@theme/MDXComponents/Ul';
9+
import MDXLi from '@theme/MDXComponents/Li';
10+
import MDXImg from '@theme/MDXComponents/Img';
11+
import Admonition from '@theme/Admonition';
12+
import Mermaid from '@theme/Mermaid';
13+
14+
import type {MDXComponentsObject} from '@theme/MDXComponents';
15+
16+
const MDXComponents: MDXComponentsObject = {
17+
Head,
18+
details: MDXDetails, // For MD mode support, see https://github.com/facebook/docusaurus/issues/9092#issuecomment-1602902274
19+
Details: MDXDetails,
20+
code: MDXCode,
21+
a: MDXA,
22+
pre: MDXPre,
23+
ul: MDXUl,
24+
li: MDXLi,
25+
img: MDXImg,
26+
h1: (props: ComponentProps<'h1'>) => <MDXHeading as="h1" {...props} />,
27+
h2: (props: ComponentProps<'h2'>) => <MDXHeading as="h2" {...props} />,
28+
h3: (props: ComponentProps<'h3'>) => <MDXHeading as="h3" {...props} />,
29+
h4: (props: ComponentProps<'h4'>) => <MDXHeading as="h4" {...props} />,
30+
h5: (props: ComponentProps<'h5'>) => <MDXHeading as="h5" {...props} />,
31+
h6: (props: ComponentProps<'h6'>) => <MDXHeading as="h6" {...props} />,
32+
admonition: Admonition,
33+
mermaid: Mermaid,
34+
table: ({children, ...props}) => (
35+
<div className="table-wrapper">
36+
<table {...props}>{children}</table>
37+
</div>
38+
),
39+
};
40+
41+
export default MDXComponents;

0 commit comments

Comments
 (0)