UNPKG

@gsretail.com/gui-core

Version:

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

2 lines (1 loc) 1.03 kB
import e,{useState as o,useCallback as n,useEffect as t}from"react";import{StyledBox as i,StyledButton as d}from"./styled.js";import{GuiIcon as r}from"../../../../node_modules/@gsretail.com/gui-icons/dist/index.js";import{debounceFunction as l}from"../../../../function/index.js";var a=function(){var a=o(!1),f=a[0],c=a[1],m=n(l((function(){if("undefined"!=typeof window){var e=window.pageYOffset;c(e>0)}}),100),[]);t((function(){"undefined"!=typeof window&&window.addEventListener("scroll",m)}),[]);return e.createElement(i,{show:f},e.createElement(d,{onClick:function(){"undefined"!=typeof window&&window.scrollTo({left:0,top:0,behavior:"smooth"})},disableRipple:!0,"aria-label":"up"},e.createElement(r,{name:"ExpandMore",color:"#000",width:18,height:18})),e.createElement(d,{onClick:function(){"undefined"!=typeof window&&window.scrollTo({left:0,top:document.body.scrollHeight,behavior:"smooth"})},disableRipple:!0,"aria-label":"down"},e.createElement(r,{name:"ExpandMore",color:"#000",width:18,height:18})))};export{a as default};