Skip to content

Commit 1f31b0d

Browse files
authored
add border radius to in-content tables (#4806)
1 parent a6c3ee0 commit 1f31b0d

File tree

2 files changed

+74
-8
lines changed

2 files changed

+74
-8
lines changed

website/src/css/customTheme.scss

Lines changed: 33 additions & 8 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

@@ -48,6 +48,8 @@
4848
--ifm-toc-link-color: var(--ifm-color-emphasis-700);
4949
--ifm-blockquote-color: var(--ifm-font-color-base);
5050
--ifm-blockquote-font-size: 16px;
51+
--ifm-global-radius: 9px;
52+
--ifm-code-border-radius: 0.4rem;
5153
--ifm-blockquote-border-radius: var(--ifm-global-radius);
5254
--ifm-table-head-color: var(--subtle);
5355
--ifm-link-hover-decoration: none;
@@ -63,6 +65,7 @@
6365
--ifm-table-border-color: var(--ifm-toc-border-color);
6466
--ifm-table-cell-padding: 10px;
6567
--ifm-table-stripe-background: rgba(0, 0, 0, 0.02);
68+
--ifm-table-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
6669
--ifm-alert-border-radius: 20px;
6770

6871
@media (min-width: 340px) {
@@ -122,7 +125,7 @@ html[data-theme="light"] {
122125
}
123126

124127
html[data-theme="dark"] {
125-
--subtle: #7c7c7c;
128+
--subtle: #858993;
126129

127130
--navbar-background: #20232aee;
128131
--sidebar-active-item-background: #61dafb15;
@@ -132,6 +135,8 @@ html[data-theme="dark"] {
132135
--ifm-color-emphasis-300: var(--dark);
133136
--ifm-table-head-background: var(--deepdark);
134137
--ifm-table-head-color: var(--subtle);
138+
--ifm-table-stripe-background: rgba(0, 0, 0, 0.08);
139+
--ifm-table-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
135140

136141
--docsearch-searchbox-background: var(--ifm-background-color);
137142
--docsearch-modal-background: var(--deepdark);
@@ -376,10 +381,19 @@ hr {
376381
font-weight: 600;
377382
}
378383

384+
.table-wrapper {
385+
border: 1px solid var(--ifm-table-border-color);
386+
border-radius: var(--ifm-global-radius);
387+
overflow: hidden;
388+
box-shadow: var(--ifm-table-box-shadow);
389+
margin-bottom: var(--ifm-spacing-vertical);
390+
}
391+
379392
table {
380393
display: table;
381394
width: 100%;
382395
table-layout: fixed;
396+
margin-bottom: 0;
383397

384398
thead tr {
385399
border: 0;
@@ -389,12 +403,24 @@ hr {
389403
padding: 6px var(--ifm-table-cell-padding);
390404
font-size: 80%;
391405
text-align: start;
406+
border: 0;
407+
border-right: 1px solid var(--ifm-table-border-color);
408+
409+
&:last-child {
410+
border-right: 0;
411+
}
392412
}
393413

394414
tr td {
395415
font-size: 90%;
396416
line-height: 1.3em;
397417
text-align: start;
418+
border: 0;
419+
border-right: 1px solid var(--ifm-table-border-color);
420+
421+
&:last-child {
422+
border-right: 0;
423+
}
398424

399425
code {
400426
display: inline-block;
@@ -464,10 +490,10 @@ hr {
464490

465491
div[class*="codeBlockContainer"] {
466492
box-shadow: none;
467-
border-radius: 8px;
493+
border-radius: var(--ifm-global-radius);
468494

469495
pre {
470-
border-radius: 8px;
496+
border-radius: var(--ifm-global-radius);
471497
}
472498

473499
button {
@@ -1132,7 +1158,7 @@ aside[class^="theme-doc-sidebar-container"] {
11321158
}
11331159

11341160
.menu__link {
1135-
border-radius: 8px;
1161+
border-radius: var(--ifm-global-radius);
11361162
padding: 6px 12px;
11371163
}
11381164

@@ -1315,7 +1341,6 @@ div[class^="tableOfContents"] {
13151341
.table-of-contents__link--active {
13161342
font-weight: 500;
13171343
color: var(--home-button-primary) !important;
1318-
border-radius: 8px;
13191344

13201345
code {
13211346
font-weight: 700;
@@ -1636,7 +1661,7 @@ div[class*="announcementBarContent"] {
16361661
float: left;
16371662
width: 36px;
16381663
height: 36px;
1639-
border-radius: 8px;
1664+
border-radius: var(--ifm-global-radius);
16401665
background-color: #6170af;
16411666
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 23 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 18.036c.042.507.221 1.016.692 1.699.558.81 1.518 1.254 2.218.54.473-.481 5.582-9.335 8.045-12.69a.737.737 0 011.202 0c2.463 3.355 7.572 12.209 8.045 12.69.7.714 1.66.27 2.218-.54.55-.798.702-1.358.702-1.955 0-.407-7.958-15.086-8.76-16.308C13.593.297 13.357.042 12.053 0h-.994c-1.304.041-1.54.297-2.31 1.472C7.964 2.67.317 16.77 0 17.737v.299z' fill='%23fff'/%3E%3C/svg%3E%0A");
16421667
background-repeat: no-repeat;
@@ -2038,7 +2063,7 @@ html[data-theme="dark"] .docsRating {
20382063
a[class*="sidebarItemLink"] {
20392064
border-left: 0 !important;
20402065
padding: 4px 12px !important;
2041-
border-radius: 8px;
2066+
border-radius: var(--ifm-global-radius);
20422067
transition:
20432068
color 0.15s,
20442069
background-color 0.15s;
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)