MCPcopy Create free account
hub / github.com/dailydotdev/apps / ShellTopButton

Function ShellTopButton

packages/shared/src/components/shell/ShellTopButton.tsx:41–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39// same way), fades in once a screen of feed has gone by and takes the page
40// back to the top.
41export const ShellTopButton = (): ReactElement => {
42 const shown = useScrolledPastViewport();
43
44 return (
45 <button
46 type="button"
47 aria-label="Back to top"
48 aria-hidden={!shown}
49 tabIndex={shown ? 0 : -1}
50 onClick={() => {
51 window.scrollTo({ top: 0, behavior: 'smooth' });
52 revealShell();
53 }}
54 className={classNames(
55 'shell-material shell-material-action shell-press shell-hit shell-top-button fixed flex size-[2.375rem] items-center justify-center rounded-14 text-text-primary',
56 shown
57 ? 'pointer-events-auto opacity-100'
58 : 'pointer-events-none translate-y-2 opacity-0',
59 )}
60 style={{
61 right: cluster.inset,
62 bottom: `calc(${cluster.floor} + ${cluster.rest + cluster.gap}px)`,
63 transitionProperty: 'opacity, translate, transform, scale',
64 transitionDuration: `${motion.enter}ms`,
65 transitionTimingFunction: motion.interaction,
66 }}
67 >
68 <MoveToIcon size={IconSize.XSmall} className="-rotate-90" />
69 </button>
70 );
71};

Callers

nothing calls this directly

Calls 2

revealShellFunction · 0.90
useScrolledPastViewportFunction · 0.85

Tested by

no test coverage detected