1
1
import { CSSProperties } from 'react'
2
2
3
+ import {
4
+ parallelContainerConfig ,
5
+ serialContainerConfig
6
+ } from '@subjects/views/pipeline-edit/mocks/pipelineExecutionMock'
7
+
3
8
import { Button , Icon } from '@harnessio/ui/components'
4
9
5
- const CONTAINER_WIDTH = '36 '
6
- const CONTAINER_HEIGHT = '36 '
10
+ const CONTAINER_WIDTH = '40 '
11
+ const CONTAINER_HEIGHT = '40 '
7
12
8
13
export interface FloatingAddButtonProp {
9
14
parentNodeType ?: 'leaf' | 'serial' | 'parallel'
10
15
position : 'before' | 'after'
11
16
onClick : ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => void
17
+ collapsed ?: boolean
12
18
}
13
19
14
20
export function FloatingAddButton ( props : FloatingAddButtonProp ) {
15
- const { onClick, position, parentNodeType } = props
21
+ const { onClick, position, parentNodeType, collapsed } = props
16
22
17
23
const style : CSSProperties = { }
18
24
if ( position === 'before' && parentNodeType === 'serial' ) {
@@ -38,20 +44,31 @@ export function FloatingAddButton(props: FloatingAddButtonProp) {
38
44
style . right = '0px'
39
45
}
40
46
47
+ const typeStyleConf =
48
+ parentNodeType === 'parallel'
49
+ ? parallelContainerConfig
50
+ : parentNodeType === 'serial'
51
+ ? serialContainerConfig
52
+ : undefined
53
+ const buttonMarginTopValue =
54
+ ! ! typeStyleConf && collapsed === false ? typeStyleConf . paddingTop - typeStyleConf . paddingBottom : 0
55
+
41
56
return (
42
57
< div className = "group absolute flex size-full items-center justify-center" style = { style } >
43
58
< Button
44
- className = "bg-background-2 hidden size-6 self-center rounded-full p-1 group-hover:flex"
45
- style = { { alignSelf : 'center' } }
46
- variant = { 'outline' }
47
- size = { 'sm' }
59
+ className = "bg-background-9 hidden size-5 self-center rounded-full p-0 group-hover:flex"
60
+ style = { {
61
+ alignSelf : 'center' ,
62
+ marginTop : `${ buttonMarginTopValue } px`
63
+ } }
64
+ variant = "outline"
48
65
onMouseDown = { e => e . stopPropagation ( ) }
49
66
onClick = { e => {
50
67
e . stopPropagation ( )
51
68
onClick ( e )
52
69
} }
53
70
>
54
- < Icon name = "plus" size = { 15 } />
71
+ < Icon className = "text-icons-3" name = "bold- plus" size = { 10 } />
55
72
</ Button >
56
73
</ div >
57
74
)
0 commit comments