diff --git a/src/ui/component/comment/view.jsx b/src/ui/component/comment/view.jsx
index 0ce7c8068..f43eeae22 100644
--- a/src/ui/component/comment/view.jsx
+++ b/src/ui/component/comment/view.jsx
@@ -2,6 +2,7 @@
import React from 'react';
import relativeDate from 'tiny-relative-date';
import Button from 'component/button';
+import Expandable from 'component/expandable';
type Props = {
author: string,
@@ -25,8 +26,11 @@ function Comment(props: Props) {
{relativeDate(timePosted)}
-
-
{message}
+
);
}
diff --git a/src/ui/component/expandable/view.jsx b/src/ui/component/expandable/view.jsx
index 381dcfee3..607e713a8 100644
--- a/src/ui/component/expandable/view.jsx
+++ b/src/ui/component/expandable/view.jsx
@@ -1,7 +1,8 @@
// @flow
-import React, { PureComponent } from 'react';
+import React, { useRef, useState } from 'react';
import classnames from 'classnames';
import Button from 'component/button';
+import { useRect } from '@reach/rect';
// Note:
// When we use this in other parts of the app, we will probably need to
@@ -11,48 +12,38 @@ type Props = {
children: React$Node | Array,
};
-type State = {
- expanded: boolean,
-};
+export default function Expandable(props: Props) {
+ const [expanded, setExpanded] = useState(false);
+ const { children } = props;
+ const ref = useRef();
+ const rect = useRect(ref);
-export default class Expandable extends PureComponent {
- constructor() {
- super();
-
- this.state = {
- expanded: false,
- };
-
- (this: any).handleClick = this.handleClick.bind(this);
+ function handleClick() {
+ setExpanded(!expanded);
}
- handleClick() {
- this.setState({
- expanded: !this.state.expanded,
- });
- }
-
- render() {
- const { children } = this.props;
- const { expanded } = this.state;
-
- return (
-
-
- {children}
+ return (
+
+ {rect && rect.height > 120 ? (
+
-
-
- );
- }
+ ) : (
+
{children}
+ )}
+
+ );
}
diff --git a/src/ui/scss/component/_expandable.scss b/src/ui/scss/component/_expandable.scss
index b65f8ec48..867b63e69 100644
--- a/src/ui/scss/component/_expandable.scss
+++ b/src/ui/scss/component/_expandable.scss
@@ -1,5 +1,5 @@
.expandable {
- border-bottom: 1px solid $lbry-gray-1;
+ //border-bottom: 1px solid $lbry-gray-1;
margin-bottom: var(--spacing-medium);
padding-bottom: var(--spacing-medium);