Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Brant Ashe committed May 28, 2024
1 parent 122f6e2 commit f1f679d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/(test)/test/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const metadata: Metadata = {
export default function RootLayout() {
return (
<html lang="en">
<body className={inter.className}>
<body className={inter.className} style={{ margin: 0 }}>
<BgBanner />
</body>
</html>
Expand Down
30 changes: 17 additions & 13 deletions src/components/BgBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import { useEffect, useLayoutEffect, useState } from 'react';
import { useEffect, useLayoutEffect, useRef, useState } from 'react';

import styles from './testcomponents.module.css';
// import styles from './testcomponents.module.css';

type BgBannerProps = {
debug?: boolean;
Expand All @@ -13,9 +13,15 @@ export default function TestBgBanner({ debug }: BgBannerProps) {
x: number;
y: number;
} | null>();
useLayoutEffect(() => {
window.scrollTo(0, 0);
}, []);
const ref = useRef<HTMLDivElement>(null);

// useLayoutEffect(() => {
// const node = ref.current;

// if (node) {
// node.style.top = '50svh';
// }
// }, []);

useEffect(() => {
// TODO: debounce
Expand All @@ -35,21 +41,19 @@ export default function TestBgBanner({ debug }: BgBannerProps) {

return (
<>
{/* <div
<div
ref={ref}
style={{
display: 'flex',
alignItems: 'center',
top: '50svh',
transform: 'translateY(50%)',
position: 'absolute',
top: 'calc(50svh - 200px)',
height: 400,
width: '100%',
margin: 0,
background: 'red',
}}
>
test
</div> */}
<div className={styles['bg-banner']} />
</div>
{/* <div className={styles['bg-banner']} /> */}
{debug ? (
<div>
{orientation?.x || 0}, {orientation?.y || 0}
Expand Down

0 comments on commit f1f679d

Please sign in to comment.