File tree Expand file tree Collapse file tree 3 files changed +44
-33
lines changed Expand file tree Collapse file tree 3 files changed +44
-33
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ const avatarVariants = cva(
16
16
{
17
17
variants : {
18
18
size : {
19
- lg : "h-10 w-10 rounded-[6px] text-sm font-medium" ,
20
- default : "h-6 w-6 text-2xs" ,
21
- sm : "h-[18px ] w-[18px ] text-[8px]" ,
19
+ lg : "h-[--avatar-lg] w-[--avatar-lg] rounded-[6px] text-sm font-medium" ,
20
+ default : "h-[--avatar-default] w-[--avatar-default] text-2xs" ,
21
+ sm : "h-[--avatar-sm ] w-[--avatar-sm ] text-[8px]" ,
22
22
} ,
23
23
variant : {
24
24
default : "" ,
Original file line number Diff line number Diff line change
1
+ import type { Interpolation } from "@emotion/react" ;
1
2
import TableRow , { type TableRowProps } from "@mui/material/TableRow" ;
2
3
import { forwardRef } from "react" ;
4
+ import type { Theme } from "theme" ;
3
5
4
6
interface TimelineEntryProps extends TableRowProps {
5
7
clickable ?: boolean ;
@@ -12,39 +14,44 @@ export const TimelineEntry = forwardRef<
12
14
return (
13
15
< TableRow
14
16
ref = { ref }
15
- css = { ( theme ) => [
16
- {
17
- "&:focus" : {
18
- outlineStyle : "solid" ,
19
- outlineOffset : - 1 ,
20
- outlineWidth : 2 ,
21
- outlineColor : theme . palette . primary . main ,
22
- } ,
23
- "& td" : {
24
- position : "relative" ,
25
- overflow : "hidden" ,
26
- } ,
27
- "& td:before" : {
28
- position : "absolute" ,
29
- left : 49 , // 50px - (width / 2)
30
- display : "block" ,
31
- content : "''" ,
32
- height : "100%" ,
33
- width : 2 ,
34
- background : theme . palette . divider ,
35
- } ,
36
- } ,
37
- clickable && {
38
- cursor : "pointer" ,
39
-
40
- "&:hover" : {
41
- backgroundColor : theme . palette . action . hover ,
42
- } ,
43
- } ,
44
- ] }
17
+ css = { [ styles . row , clickable ? styles . clickable : null ] }
45
18
{ ...props }
46
19
>
47
20
{ children }
48
21
</ TableRow >
49
22
) ;
50
23
} ) ;
24
+
25
+ const styles = {
26
+ row : ( theme ) => ( {
27
+ "--side-padding" : "32px" ,
28
+ "&:focus" : {
29
+ outlineStyle : "solid" ,
30
+ outlineOffset : - 1 ,
31
+ outlineWidth : 2 ,
32
+ outlineColor : theme . palette . primary . main ,
33
+ } ,
34
+ "& td" : {
35
+ position : "relative" ,
36
+ overflow : "hidden" ,
37
+ } ,
38
+ "& td:before" : {
39
+ "--line-width" : "2px" ,
40
+ position : "absolute" ,
41
+ left : "calc((var(--side-padding) + var(--avatar-default)/2) - var(--line-width) / 2)" ,
42
+ display : "block" ,
43
+ content : "''" ,
44
+ height : "100%" ,
45
+ width : "var(--line-width)" ,
46
+ background : theme . palette . divider ,
47
+ } ,
48
+ } ) ,
49
+
50
+ clickable : ( theme ) => ( {
51
+ cursor : "pointer" ,
52
+
53
+ "&:hover" : {
54
+ backgroundColor : theme . palette . action . hover ,
55
+ } ,
56
+ } ) ,
57
+ } satisfies Record < string , Interpolation < Theme > > ;
Original file line number Diff line number Diff line change 31
31
--border : 240 5.9% 90% ;
32
32
--input : 240 5.9% 90% ;
33
33
--ring : 240 10% 3.9% ;
34
+
35
+ --avatar-lg : 2.5rem ;
36
+ --avatar-default : 1.5rem ;
37
+ --avatar-sm : 1.125rem ;
34
38
}
35
39
.dark {
36
40
--content-primary : 0 , 0% , 98% ;
You can’t perform that action at this time.
0 commit comments