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