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,UAAWP,EAAM,wCACjBS,IAAKb,KAAKjB,cAFd,UAGI,cACI4B,UAAWP,EAAM,+BACjBS,IAAKb,KAAKf,KAFd,SAGKkB,MAGRf,IACG,yBACKE,GACG,iBACIqB,UAAS,UAAKP,EAAM,uCAAX,YAAyDA,EAAO,iDACzEU,QAASd,KAAKP,eAFlB,0BAMA,iBACIkB,UAAS,UAAKP,EAAM,uCAAX,YAAyDA,EAAO,iDACzEU,QAASd,KAAKP,eAFlB,iC,EAvD1Bb,CAA0BiB,EAAAA,eAuGhCjB,EAAkBmC,YAAcC,EAAAA,EAEhC,ICtHA,EDsHA,G,kBEvHAC,EAAOC,QAAU,CAAC,kBAAoB,qDAAqD,yBAA2B,4DAA4D,wCAA0C,2EAA2E,4BAA4B,6DAA6D,8BAA8B,+DAA+D,+BAAiC,kEAAkE,2BAA6B,8DAA8D,uCAAyC,0EAA0E,+CAA+C,gFAAgF,+CAA+C,kF,kBCA57BD,EAAOC,QAAU,CAAC,kBAAoB,mDAAmD,yBAA2B,0DAA0D,wCAA0C,yEAAyE,4BAA4B,2DAA2D,8BAA8B,6DAA6D,+BAAiC,gEAAgE,2BAA6B,4DAA4D,4BAA8B,6DAA6D,oCAAoC,mEAAmE,oCAAoC,mEAAmE,uCAAyC,wEAAwE,+CAA+C","sources":["webpack://_N_E/./components/FactsEstateObject/FactsEstateObject.js","webpack://_N_E/./components/FactsEstateObject/index.js","webpack://_N_E/./components/FactsEstateObject/FactsEstateObject.folkhem.module.scss","webpack://_N_E/./components/FactsEstateObject/FactsEstateObject.nordr.module.scss"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport debounce from 'debounce';\nimport { trackEvent } from '../../utils/DataLayerHelpers';\nimport { ThemeContext, themes } from '../../themes/ThemeContext';\nimport stylesNordr from './FactsEstateObject.nordr.module.scss';\nimport stylesFolkhem from './FactsEstateObject.folkhem.module.scss';\n\nconst getStyles = (theme) => ({\n [themes.NORDR]: stylesNordr,\n [themes.FOLKHEM]: stylesFolkhem,\n }[theme]\n);\n\nclass FactsEstateObject extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n showMore: false,\n active: false,\n };\n\n this.textContainer = React.createRef();\n this.text = React.createRef();\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.checkOverflow, true);\n }\n\n componentDidMount() {\n window.addEventListener('resize', this.checkOverflow, true);\n this.checkOverflow();\n }\n\n render() {\n const { showMore, active } = this.state;\n const { title, description } = this.props;\n\n const globalTheme = this.context;\n const styles = getStyles(globalTheme);\n\n return (\n \n
\n

{title}

\n \n \n {description}\n

\n
\n {showMore && (\n
\n {active ? (\n \n Visa mindre\n \n ) : (\n \n Visa mer\n \n )}\n
\n )}\n \n \n );\n }\n\n _checkOverflow = () => {\n const textContainer = this.textContainer.current;\n const text = this.text.current;\n\n const refsNotSet =\n typeof textContainer === 'undefined' || typeof text === 'undefined';\n\n this.setState({\n showMore: refsNotSet\n ? false\n : textContainer.offsetHeight < text.offsetHeight,\n active: false,\n });\n };\n checkOverflow = debounce(this._checkOverflow, 300);\n\n toggleShowMore = () => {\n trackEvent(\n 'textShowMore',\n 'show',\n 'click',\n this.state.active ? 'less' : 'more'\n );\n\n this.setState((prevState) => ({\n active: !prevState.active,\n }));\n };\n}\n\nFactsEstateObject.propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n};\n\nFactsEstateObject.contextType = ThemeContext;\n\nexport default FactsEstateObject;\n","import FactsEstateObject from './FactsEstateObject';\n\nexport default FactsEstateObject;\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"FactsEstateObject\":\"FactsEstateObject_folkhem_FactsEstateObject__6neQY\",\"FactsEstateObject__Title\":\"FactsEstateObject_folkhem_FactsEstateObject__Title__8Fm6X\",\"FactsEstateObject__DescriptionContainer\":\"FactsEstateObject_folkhem_FactsEstateObject__DescriptionContainer__CHrPy\",\"FactsEstateObject--Active\":\"FactsEstateObject_folkhem_FactsEstateObject--Active__PgRJC\",\"FactsEstateObject--ShowMore\":\"FactsEstateObject_folkhem_FactsEstateObject--ShowMore__sXyCD\",\"FactsEstateObject__Description\":\"FactsEstateObject_folkhem_FactsEstateObject__Description__GGnYI\",\"FactsEstateObject__Content\":\"FactsEstateObject_folkhem_FactsEstateObject__Content__HwxI3\",\"FactsEstateObject__CardMedia__ShowMore\":\"FactsEstateObject_folkhem_FactsEstateObject__CardMedia__ShowMore__nX1QG\",\"FactsEstateObject__CardMedia__ShowMore--More\":\"FactsEstateObject_folkhem_FactsEstateObject__CardMedia__ShowMore--More__SN8Ca\",\"FactsEstateObject__CardMedia__ShowMore--Less\":\"FactsEstateObject_folkhem_FactsEstateObject__CardMedia__ShowMore--Less__C3eJZ\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"FactsEstateObject\":\"FactsEstateObject_nordr_FactsEstateObject__DlDb8\",\"FactsEstateObject__Title\":\"FactsEstateObject_nordr_FactsEstateObject__Title__YSEFK\",\"FactsEstateObject__DescriptionContainer\":\"FactsEstateObject_nordr_FactsEstateObject__DescriptionContainer__dpaX_\",\"FactsEstateObject--Active\":\"FactsEstateObject_nordr_FactsEstateObject--Active__OYppq\",\"FactsEstateObject--ShowMore\":\"FactsEstateObject_nordr_FactsEstateObject--ShowMore__lfv3M\",\"FactsEstateObject__Description\":\"FactsEstateObject_nordr_FactsEstateObject__Description___kWOW\",\"FactsEstateObject__Content\":\"FactsEstateObject_nordr_FactsEstateObject__Content__fzteE\",\"FactsEstateObject__ShowMore\":\"FactsEstateObject_nordr_FactsEstateObject__ShowMore__iPnju\",\"FactsEstateObject__ShowMore--More\":\"FactsEstateObject_nordr_FactsEstateObject__ShowMore--More__ZUwQ4\",\"FactsEstateObject__ShowMore--Less\":\"FactsEstateObject_nordr_FactsEstateObject__ShowMore--Less__8_9Ds\",\"FactsEstateObject__CardMedia__ShowMore\":\"FactsEstateObject_nordr_FactsEstateObject__CardMedia__ShowMore__fcRxn\",\"FactsEstateObject__CardMedia__ShowMore--Less\":\"FactsEstateObject_nordr_FactsEstateObject__CardMedia__ShowMore--Less__W06Vy\"};"],"names":["FactsEstateObject","props","_checkOverflow","textContainer","current","text","refsNotSet","setState","showMore","offsetHeight","active","checkOverflow","debounce","toggleShowMore","trackEvent","state","prevState","React","window","removeEventListener","this","addEventListener","title","description","styles","theme","themes","stylesNordr","stylesFolkhem","getStyles","context","className","classNames","ref","onClick","contextType","ThemeContext","module","exports"],"sourceRoot":""}