|
|
@ -3,14 +3,23 @@ import React, { MutableRefObject } from 'react' |
|
|
|
|
|
|
|
|
|
|
|
export interface ChevronProps { |
|
|
|
export interface ChevronProps { |
|
|
|
divElementRef: MutableRefObject<any> |
|
|
|
divElementRef: MutableRefObject<any> |
|
|
|
cssRule: string |
|
|
|
cssRule: string, |
|
|
|
|
|
|
|
direction: string |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function Chevron (props: ChevronProps) { |
|
|
|
function Chevron (props: ChevronProps) { |
|
|
|
|
|
|
|
const click = () => { |
|
|
|
|
|
|
|
if (props.direction === 'down') { |
|
|
|
|
|
|
|
props.divElementRef.current.scrollBy(0, 40) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
props.divElementRef.current.scrollBy(0, -40) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ props.divElementRef.current && props.divElementRef.current.scrollHeight > props.divElementRef.current.clientHeight |
|
|
|
{ props.divElementRef.current && props.divElementRef.current.scrollHeight > props.divElementRef.current.clientHeight |
|
|
|
? <i className={props.cssRule}></i> : null } |
|
|
|
? <i onClick={click} className={props.cssRule}></i> : null } |
|
|
|
</> |
|
|
|
</> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|