1- /*
2- * decaffeinate suggestions:
3- * DS102: Remove unnecessary code created because of implicit returns
4- * DS207: Consider shorter variations of null checks
5- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
6- */
71import { useContext } from "react" ;
82import h from "../hyper" ;
9- import T from "prop-types" ;
103import { NoteLayoutContext } from "./layout" ;
114
12- const HeightRangeAnnotation = function ( props ) {
5+ interface HeightRangeAnnotationProps {
6+ height : number ;
7+ top_height ?: number ;
8+ offsetX ?: number ;
9+ color ?: string ;
10+ lineInset ?: number ;
11+ }
12+
13+ function HeightRangeAnnotation ( props : HeightRangeAnnotationProps ) {
1314 const { scale } = useContext ( NoteLayoutContext ) ;
14- const { height, top_height, offsetX, color, lineInset = 2.5 , ...rest } = props ;
15+ const {
16+ height,
17+ top_height,
18+ offsetX = 0 ,
19+ color,
20+ lineInset = 2.5 ,
21+ ...rest
22+ } = props ;
1523
1624 const bottomHeight = scale ( height ) ;
1725 let pxHeight = 0 ;
@@ -20,7 +28,7 @@ const HeightRangeAnnotation = function(props) {
2028 }
2129 const topHeight = bottomHeight - pxHeight ;
2230
23- const isLine = pxHeight > 2 * lineInset ;
31+ const isLine = pxHeight > 2 * lineInset ;
2432
2533 const transform = `translate(${ offsetX } ,${ topHeight } )` ;
2634
@@ -29,20 +37,13 @@ const HeightRangeAnnotation = function(props) {
2937 x1 : 0 ,
3038 x2 : 0 ,
3139 y1 : lineInset ,
32- y2 : pxHeight - lineInset
40+ y2 : pxHeight - lineInset ,
41+ } ) ,
42+ h . if ( ! isLine ) ( "circle" , {
43+ r : 2 ,
44+ transform : `translate(0,${ pxHeight / 2 } )` ,
3345 } ) ,
34- h . if ( ! isLine ) ( "circle" , { r : 2 , transform : `translate(0,${ pxHeight / 2 } )` } ) ,
3546 ] ) ;
36- } ;
37-
38- HeightRangeAnnotation . propTypes = {
39- height : T . number . isRequired ,
40- top_height : T . number ,
41- offsetX : T . number
42- } ;
43-
44- HeightRangeAnnotation . defaultProps = {
45- offsetX : 0
46- } ;
47+ }
4748
4849export { HeightRangeAnnotation } ;
0 commit comments