"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("prop-types"),n=require("@material-ui/core"),i=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),l=a(r),u=n.makeStyles((function(e){return{contentWrapper:{position:"relative"},content:{overflow:"hidden"},readMore:{height:40,display:"block",textAlign:"right"},blackOut:{width:"100%",position:"absolute",justifyContent:"flex-end",background:"linear-gradient(to bottom, transparent, ".concat(e.palette.background.paper,")"),height:40,marginTop:-40}}})),c=function(e){var r=e.maxHeight,a=e.children,l=u(),c=t.useState(!1),s=o.default(c,2),d=s[0],f=s[1],h=t.useState(!1),p=o.default(h,2),m=p[0],g=p[1],x=t.useRef();return t.useEffect((function(){!function(){var e=r&&x.current.clientHeight>r+40;g(e),f(e)}()}),[a]),i.jsxs("div",{className:l.contentWrapper,children:[i.jsx("div",{className:l.content,style:{maxHeight:m?r:"initial"},children:i.jsx("div",{ref:x,children:a})}),d&&i.jsxs("div",{className:l.readMore,children:[m&&i.jsx("div",{className:l.blackOut}),i.jsx(n.Button,{onClick:function(){g((function(e){return!e})),m&&window.innerHeight<x.current.clientHeight&&x.current.scrollIntoView()},children:m?i.jsx(i.Fragment,{children:"Read more …"}):"Show less"})]})]})};c.propTypes={children:l.default.oneOfType([l.default.node,l.default.string]).isRequired,maxHeight:l.default.number},c.defaultProps={maxHeight:120},module.exports=c;
