@@ -6,14 +6,12 @@ import {
6
6
useRef ,
7
7
useState ,
8
8
} from 'react' ;
9
- import styled from 'styled-components' ;
10
9
11
10
import { Block } from '../../Block' ;
12
- import { Action , CubeActionProps } from '../../actions/Action ' ;
11
+ import { Action , Button , CubeActionProps } from '../../actions' ;
13
12
import { Space } from '../../layout/Space' ;
14
13
import { CubeFlexProps , Flex } from '../../layout/Flex' ;
15
14
import { Styles , tasty } from '../../../tasty' ;
16
- import { Button } from '../../actions' ;
17
15
import { useLayoutEffect } from '../../../utils/react' ;
18
16
import { CloseIcon } from '../../../icons' ;
19
17
@@ -39,39 +37,31 @@ const FileTabsContext = createContext<FileTabContextValue>({
39
37
} ) ;
40
38
41
39
const TabsPanelElement = tasty ( Space , {
40
+ qa : 'TabsPanel' ,
42
41
styles : {
42
+ position : 'relative' ,
43
+ overflow : 'auto hidden' ,
44
+ top : '1bw' ,
43
45
gap : '.5x' ,
44
46
flexShrink : 0 ,
47
+ whiteSpace : 'nowrap' ,
48
+ styledScrollbar : true ,
49
+ padding : '1ow 1ow 0 1ow' ,
50
+ fade : {
51
+ '' : false ,
52
+ '[data-is-left-fade]' : '3x left' ,
53
+ '[data-is-right-fade]' : '3x right' ,
54
+ '[data-is-right-fade] & [data-is-left-fade]' : '3x left right' ,
55
+ } ,
56
+ transition : 'fade' ,
57
+ '--scrollbar-radius' : '1ow' ,
58
+ '--scrollbar-width' : '.75x' ,
59
+ '--scrollbar-outline-width' : '1px' ,
45
60
} ,
46
61
} ) ;
47
62
48
- const StyledTabsPanelElement = styled ( TabsPanelElement ) `
49
- position: relative;
50
- overflow: auto hidden;
51
- top: 1px;
52
- white-space: nowrap;
53
-
54
- ::-webkit-scrollbar-track {
55
- background: var(--grey-light-color);
56
- }
57
-
58
- ::-webkit-scrollbar-thumb {
59
- border-radius: 1px;
60
- background: var(--dark-04-color);
61
- background-clip: padding-box;
62
- }
63
-
64
- ::-webkit-scrollbar-corner {
65
- background-color: transparent;
66
- }
67
-
68
- ::-webkit-scrollbar {
69
- width: 3px;
70
- height: 3px;
71
- }
72
- ` ;
73
-
74
63
const TabsContainerElement = tasty ( Flex , {
64
+ qa : 'TabsContainer' ,
75
65
styles : {
76
66
flow : 'column' ,
77
67
height : 'max 100%' ,
@@ -80,51 +70,6 @@ const TabsContainerElement = tasty(Flex, {
80
70
} ,
81
71
} ) ;
82
72
83
- const StyledTabsContainerElement = styled ( TabsContainerElement ) `
84
- &::before {
85
- content: '';
86
- display: block;
87
- opacity: 0;
88
- position: absolute;
89
- top: 0;
90
- left: 0;
91
- pointer-events: none;
92
- width: 32px;
93
- height: 37px;
94
- transition: all 0.15s linear;
95
- background-image: linear-gradient(
96
- to left,
97
- rgba(255, 255, 255, 0),
98
- rgba(255, 255, 255, 1)
99
- );
100
- z-index: 1;
101
- }
102
-
103
- &::after {
104
- content: '';
105
- display: block;
106
- opacity: 0;
107
- position: absolute;
108
- top: 0;
109
- right: 0;
110
- width: 32px;
111
- height: 37px;
112
- pointer-events: none;
113
- transition: all 0.15s linear;
114
- background-image: linear-gradient(
115
- to right,
116
- rgba(255, 255, 255, 0),
117
- rgba(255, 255, 255, 1)
118
- );
119
- z-index: 1;
120
- }
121
-
122
- &[data-is-left-fade]::before,
123
- &[data-is-right-fade]::after {
124
- opacity: 1;
125
- }
126
- ` ;
127
-
128
73
const DirtyBadge = tasty ( {
129
74
element : 'DirtyBadge' ,
130
75
styles : {
@@ -266,7 +211,7 @@ export interface CubeFileTabsProps extends CubeFlexProps {
266
211
onTabClick ?: ( string ) => void ;
267
212
/** Handler that is called when the tab is closed. */
268
213
onTabClose ?: ( string ) => void ;
269
- /** Styles for the each tab pane */
214
+ /** Styles for each tab pane */
270
215
paneStyles ?: Styles ;
271
216
/** Whether the tabs are closable */
272
217
isClosable ?: boolean ;
@@ -407,11 +352,7 @@ export function FileTabs({
407
352
}
408
353
409
354
return (
410
- < StyledTabsContainerElement
411
- data-is-left-fade = { leftFade || null }
412
- data-is-right-fade = { rightFade || null }
413
- { ...props }
414
- >
355
+ < TabsContainerElement { ...props } >
415
356
< FileTabsContext . Provider
416
357
value = { {
417
358
addTab,
@@ -421,7 +362,11 @@ export function FileTabs({
421
362
currentTab : activeKey ,
422
363
} }
423
364
>
424
- < StyledTabsPanelElement ref = { tabsRef } >
365
+ < TabsPanelElement
366
+ ref = { tabsRef }
367
+ data-is-left-fade = { leftFade || null }
368
+ data-is-right-fade = { rightFade || null }
369
+ >
425
370
{ tabs . map ( ( tab ) => {
426
371
return (
427
372
< Tab
@@ -436,7 +381,7 @@ export function FileTabs({
436
381
</ Tab >
437
382
) ;
438
383
} ) }
439
- </ StyledTabsPanelElement >
384
+ </ TabsPanelElement >
440
385
< Flex
441
386
flexGrow = { 1 }
442
387
border = "top rgb(227, 227, 233)"
@@ -445,7 +390,7 @@ export function FileTabs({
445
390
{ children }
446
391
</ Flex >
447
392
</ FileTabsContext . Provider >
448
- </ StyledTabsContainerElement >
393
+ </ TabsContainerElement >
449
394
) ;
450
395
}
451
396
@@ -481,7 +426,7 @@ FileTabs.TabPane = function FileTabPane(allProps: CubeFileTabProps) {
481
426
482
427
return (
483
428
< Block
484
- style = { { display : isCurrent ? 'block' : 'none' } }
429
+ style = { { display : isCurrent ? 'block' : 'none' , maxWidth : '100%' } }
485
430
flexGrow = { 1 }
486
431
{ ...props }
487
432
>
0 commit comments