addons/isl/src/BranchIndicator.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318const COMPONENT_PADDING = 10;
b69ab319export const BranchIndicator = () => {
b69ab3110 const width = COMPONENT_PADDING * 2;
b69ab3111 const height = COMPONENT_PADDING * 3;
b69ab3112 // Compensate for line width
b69ab3113 const startX = width + 1;
b69ab3114 const startY = 0;
b69ab3115 const endX = 0;
b69ab3116 const endY = height;
b69ab3117 const verticalLead = height * 0.75;
b69ab3118 const path =
b69ab3119 // start point
b69ab3120 `M${startX} ${startY}` +
b69ab3121 // cubic bezier curve to end point
b69ab3122 `C ${startX} ${startY + verticalLead}, ${endX} ${endY - verticalLead}, ${endX} ${endY}`;
b69ab3123 return (
b69ab3124 <svg
b69ab3125 className="branch-indicator"
b69ab3126 width={width + 2 /* avoid border clipping */}
b69ab3127 height={height}
b69ab3128 xmlns="http://www.w3.org/2000/svg">
b69ab3129 <path d={path} strokeWidth="2px" fill="transparent" />
b69ab3130 </svg>
b69ab3131 );
b69ab3132};