Skip to content

Commit 2ff1075

Browse files
committed
Use more classes in module.css
1 parent 3c4807a commit 2ff1075

File tree

3 files changed

+16
-123
lines changed

3 files changed

+16
-123
lines changed

packages/gitbook/src/components/DocumentView/Table/RecordRow.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { DocumentTableViewGrid } from '@gitbook/api';
22
import React from 'react';
33

4-
import { tcls } from '@/lib/tailwind';
5-
64
import { RecordColumnValue } from './RecordColumnValue';
75
import { TableRecordKV, TableViewProps } from './Table';
6+
import styles from './table.module.css';
87
import { getColumnWidth } from './ViewGrid';
98

109
export function RecordRow(
@@ -17,10 +16,7 @@ export function RecordRow(
1716
const { view, autoSizedColumns, fixedColumns } = props;
1817

1918
return (
20-
<div
21-
className={tcls('flex', 'border-dark/3', 'dark:border-light/2', '[&>*+*]:border-l')}
22-
role="row"
23-
>
19+
<div className={styles.row} role="row">
2420
{view.columns.map((column) => {
2521
const columnWidth = getColumnWidth({
2622
column,
@@ -32,16 +28,7 @@ export function RecordRow(
3228
<div
3329
key={column}
3430
role="cell"
35-
className={tcls(
36-
'flex-1',
37-
'align-middle',
38-
'border-dark/2',
39-
'py-2',
40-
'px-3',
41-
'text-sm',
42-
'lg:text-base',
43-
'dark:border-light/2',
44-
)}
31+
className={styles.cell}
4532
style={{
4633
width: columnWidth,
4734
minWidth: columnWidth || '100px',

packages/gitbook/src/components/DocumentView/Table/ViewGrid.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,7 @@ export function ViewGrid(props: TableViewProps<DocumentTableViewGrid>) {
2929
view.columns.some((columnId) => block.data.definition[columnId].title.trim().length > 0);
3030

3131
return (
32-
<div
33-
className={tcls(
34-
style,
35-
styles.progressContainer,
36-
styles.tableWrapper,
37-
'relative',
38-
'grid',
39-
'w-full',
40-
'overflow-x-auto',
41-
'overflow-y-hidden',
42-
'mx-auto',
43-
)}
44-
>
32+
<div className={tcls(style, styles.tableWrapper)}>
4533
{/* Table */}
4634
<div role="table" className={tcls('flex', 'flex-col')}>
4735
{/* Header */}
@@ -55,15 +43,7 @@ export function ViewGrid(props: TableViewProps<DocumentTableViewGrid>) {
5543
key={column}
5644
role="columnheader"
5745
className={tcls(
58-
'align-middle',
59-
'text-left',
60-
'text-base',
61-
'font-medium',
62-
'border-b',
63-
'dark:border-l-light/2',
64-
'dark:border-b-light/4',
65-
'py-2',
66-
'px-3',
46+
styles.columnHeader,
6747
alignment === 'right' ? 'text-right' : null,
6848
alignment === 'center' ? 'text-center' : null,
6949
)}

packages/gitbook/src/components/DocumentView/Table/table.module.css

Lines changed: 11 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -19,99 +19,25 @@
1919
--border-width-if-cant-scroll: 0;
2020
border-width: var(--border-width-if-can-scroll, var(--border-width-if-cant-scroll));
2121

22-
@apply border-dark/3;
22+
@apply relative grid w-full overflow-x-auto overflow-y-hidden mx-auto border-dark/3;
2323
}
2424

2525
:global(.dark) .tableWrapper {
2626
@apply border-light/2;
2727
}
2828

29-
/* Styles for circular scroll progress animation on scrollable tables */
30-
31-
/* Hide it on browsers (firefox / safari) that do not support it */
32-
.progressOpacitySharp {
33-
display: none;
29+
.row {
30+
@apply flex border-dark/3 dark:border-light/2;
3431
}
3532

36-
@supports (animation-timeline: scroll()) {
37-
.progressContainer {
38-
scroll-timeline-name: --squareTimeline;
39-
scroll-timeline-axis: x;
40-
}
41-
42-
.progressOpacity {
43-
animation-name: opacityProgress;
44-
animation-duration: 1ms;
45-
animation-direction: alternate;
46-
animation-timeline: --squareTimeline;
47-
animation-timing-function: linear;
48-
}
49-
50-
.progressOpacitySharp {
51-
display: grid;
52-
opacity: 0;
53-
animation-name: opacityProgressSharp;
54-
animation-duration: 1ms;
55-
animation-direction: alternate;
56-
animation-timeline: --squareTimeline;
57-
animation-timing-function: linear;
58-
}
59-
60-
.strokeOpacityProgressInverted {
61-
animation-name: strokeOpacityProgressInverted;
62-
animation-duration: 1ms;
63-
animation-direction: alternate;
64-
animation-timeline: --squareTimeline;
65-
animation-timing-function: linear;
66-
}
67-
68-
.progressSvg {
69-
animation-name: svgProgress;
70-
animation-duration: 1ms;
71-
animation-direction: alternate;
72-
animation-timeline: --squareTimeline;
73-
animation-timing-function: linear;
74-
}
75-
76-
@keyframes opacityProgress {
77-
0%,
78-
50% {
79-
opacity: 1;
80-
}
81-
100% {
82-
opacity: 0;
83-
}
84-
}
85-
86-
@keyframes opacityProgressSharp {
87-
0%,
88-
98% {
89-
opacity: 1;
90-
}
91-
100% {
92-
opacity: 0;
93-
}
94-
}
33+
.row > * + * {
34+
@apply border-l;
35+
}
9536

96-
@keyframes strokeOpacityProgressInverted {
97-
0%,
98-
10% {
99-
stroke-opacity: 0;
100-
}
101-
30% {
102-
stroke-opacity: 0.88;
103-
}
104-
100% {
105-
stroke-opacity: 0.88;
106-
}
107-
}
37+
.cell {
38+
@apply flex-1 align-middle border-dark/2 py-2 px-3 text-sm lg:text-base dark:border-light/2;
39+
}
10840

109-
@keyframes svgProgress {
110-
from {
111-
stroke-dasharray: 0 100;
112-
}
113-
to {
114-
stroke-dasharray: 100 100;
115-
}
116-
}
41+
.columnHeader {
42+
@apply align-middle text-left text-base font-medium border-b dark:border-l-light/2 dark:border-b-light/4 py-2 px-3;
11743
}

0 commit comments

Comments
 (0)