Skip to content

Commit

Permalink
fix(videodetail): fix unnecessary chevron collapsibletext
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Jun 24, 2021
1 parent d6eb8c3 commit a476f7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/CollapsibleText/CollapsibleText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ const CollapsibleText: React.FC<Props> = ({ text, className, maxHeight = 'none'

const ariaLabel = expanded ? 'Collapse' : 'Expand';

const clippablePixels = 4;

useEffect(() => {
divRef.current &&
setDoesFlowOver(
divRef.current.scrollHeight > divRef.current.offsetHeight || (maxHeight < divRef.current.offsetHeight && maxHeight !== 'none'),
divRef.current.scrollHeight > divRef.current.offsetHeight + clippablePixels ||
(maxHeight < divRef.current.offsetHeight && maxHeight !== 'none'),
);
}, [maxHeight, text, breakpoint]);

Expand Down

0 comments on commit a476f7a

Please sign in to comment.