@gsretail.com/gui-core
Version:
A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook
2 lines (1 loc) • 996 B
JavaScript
import e,{useState as o,useCallback as n,useEffect as t}from"react";import{StyledBox as i,StyledButton as r}from"./styled.js";import{GuiIcon as d}from"@gsretail.com/gui-icons";import{debounceFunction as l}from"../../../../function/index.js";var a=function(){var a=o(!1),f=a[0],c=a[1],w=n(l((function(){if("undefined"!=typeof window){var e=window.pageYOffset;c(e>0)}}),100),[]);t((function(){"undefined"!=typeof window&&window.addEventListener("scroll",w)}),[]);return e.createElement(i,{show:f},e.createElement(r,{onClick:function(){"undefined"!=typeof window&&window.scrollTo({left:0,top:0,behavior:"smooth"})},disableRipple:!0,"aria-label":"up"},e.createElement(d,{name:"ExpandMore",color:"#000",width:18,height:18})),e.createElement(r,{onClick:function(){"undefined"!=typeof window&&window.scrollTo({left:0,top:document.body.scrollHeight,behavior:"smooth"})},disableRipple:!0,"aria-label":"down"},e.createElement(d,{name:"ExpandMore",color:"#000",width:18,height:18})))};export{a as default};