| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | const COMPONENT_PADDING = 10; |
| b69ab31 | | | 9 | export const BranchIndicator = () => { |
| b69ab31 | | | 10 | const width = COMPONENT_PADDING * 2; |
| b69ab31 | | | 11 | const height = COMPONENT_PADDING * 3; |
| b69ab31 | | | 12 | // Compensate for line width |
| b69ab31 | | | 13 | const startX = width + 1; |
| b69ab31 | | | 14 | const startY = 0; |
| b69ab31 | | | 15 | const endX = 0; |
| b69ab31 | | | 16 | const endY = height; |
| b69ab31 | | | 17 | const verticalLead = height * 0.75; |
| b69ab31 | | | 18 | const path = |
| b69ab31 | | | 19 | // start point |
| b69ab31 | | | 20 | `M${startX} ${startY}` + |
| b69ab31 | | | 21 | // cubic bezier curve to end point |
| b69ab31 | | | 22 | `C ${startX} ${startY + verticalLead}, ${endX} ${endY - verticalLead}, ${endX} ${endY}`; |
| b69ab31 | | | 23 | return ( |
| b69ab31 | | | 24 | <svg |
| b69ab31 | | | 25 | className="branch-indicator" |
| b69ab31 | | | 26 | width={width + 2 /* avoid border clipping */} |
| b69ab31 | | | 27 | height={height} |
| b69ab31 | | | 28 | xmlns="http://www.w3.org/2000/svg"> |
| b69ab31 | | | 29 | <path d={path} strokeWidth="2px" fill="transparent" /> |
| b69ab31 | | | 30 | </svg> |
| b69ab31 | | | 31 | ); |
| b69ab31 | | | 32 | }; |