Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

1 ligne
3.3 KiB

  1. {"ast":null,"code":"import _classCallCheck from \"/Users/michielcarman/Projects/React Access/React_Client_App_Access/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"/Users/michielcarman/Projects/React Access/React_Client_App_Access/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"/Users/michielcarman/Projects/React Access/React_Client_App_Access/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"/Users/michielcarman/Projects/React Access/React_Client_App_Access/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _inherits from \"/Users/michielcarman/Projects/React Access/React_Client_App_Access/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits\";\nimport { PureComponent } from 'react';\nimport { withRouter } from 'react-router-dom';\n;\n\nvar ScrollToTop = /*#__PURE__*/function (_PureComponent) {\n _inherits(ScrollToTop, _PureComponent);\n\n function ScrollToTop() {\n _classCallCheck(this, ScrollToTop);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(ScrollToTop).apply(this, arguments));\n }\n\n _createClass(ScrollToTop, [{\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var location = this.props.location;\n\n if (location.pathname !== prevProps.location.pathname) {\n window.scrollTo(0, 0);\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var children = this.props.children;\n return children;\n }\n }]);\n\n return ScrollToTop;\n}(PureComponent);\n\nexport default withRouter(ScrollToTop);","map":{"version":3,"sources":["/Users/michielcarman/Projects/React Access/React_Client_App_Access/src/shared/components/ScrollToTop.tsx"],"names":["PureComponent","withRouter","ScrollToTop","prevProps","location","props","pathname","window","scrollTo","children"],"mappings":";;;;;AACA,SAASA,aAAT,QAA8B,OAA9B;AACA,SAAgBC,UAAhB,QAAkC,kBAAlC;AAYC;;IAEKC,W;;;;;;;;;;;uCAEeC,S,EAAgB;AAAA,UACzBC,QADyB,GACZ,KAAKC,KADO,CACzBD,QADyB;;AAEjC,UAAIA,QAAQ,CAACE,QAAT,KAAsBH,SAAS,CAACC,QAAV,CAAmBE,QAA7C,EAAuD;AACrDC,QAAAA,MAAM,CAACC,QAAP,CAAgB,CAAhB,EAAmB,CAAnB;AACD;AACF;;;6BAEQ;AAAA,UACCC,QADD,GACc,KAAKJ,KADnB,CACCI,QADD;AAEP,aAAOA,QAAP;AACD;;;;EAZuBT,a;;AAe1B,eAAeC,UAAU,CAACC,WAAD,CAAzB","sourcesContent":["import { Hash, History, LocationState, Search } from 'history';\nimport { PureComponent } from 'react';\nimport { match, withRouter } from 'react-router-dom';\n\ninterface ScrollToTopPropTypes {\n location: { \n pathname: string,\n search: Search;\n state: LocationState;\n hash: Hash;\n },\n children?: JSX.Element,\n history: History,\n match: match\n};\n\nclass ScrollToTop extends PureComponent<ScrollToTopPropTypes> {\n\n componentDidUpdate(prevProps: any) {\n const { location } = this.props;\n if (location.pathname !== prevProps.location.pathname) {\n window.scrollTo(0, 0);\n }\n }\n\n render() {\n const { children } = this.props;\n return children;\n }\n}\n\nexport default withRouter(ScrollToTop);\n"]},"metadata":{},"sourceType":"module"}