Skip to content

Commit

Permalink
test vertical centering with svh
Browse files Browse the repository at this point in the history
  • Loading branch information
Brant Ashe committed May 28, 2024
1 parent 21f35c8 commit ba3666b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/(test)/test/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TestBannerBg from '@/components/TestBannerBg';
import BgBanner from '@/components/BgBanner';
import type { Metadata } from 'next';

export const metadata: Metadata = {
Expand All @@ -10,7 +10,7 @@ export default function RootLayout() {
return (
<html lang="en">
<body>
<TestBannerBg debug />
<BgBanner debug />
</body>
</html>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { useEffect, useState } from 'react';

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

type BannerBgProps = {
type BgBannerProps = {
debug?: boolean;
};

export default function TestBannerBg({ debug }: BannerBgProps) {
export default function TestBgBanner({ debug }: BgBannerProps) {
const [orientation, setOrientation] = useState<{
x: number;
y: number;
Expand All @@ -32,7 +32,7 @@ export default function TestBannerBg({ debug }: BannerBgProps) {

return (
<>
<div className={styles['banner-bg']}>TEST</div>
<div className={styles['bg-banner']}>TEST</div>
{debug ? (
<div>
{orientation?.x || 0}, {orientation?.y || 0}
Expand Down
4 changes: 3 additions & 1 deletion src/components/testcomponents.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@
}
}

.banner-bg {
.bg-banner {
position: absolute;
height: 400px;
width: 100vw;
cursor: default;
top: 50svh;
transform: translateY(-50%);
background: red;
}

Expand Down

0 comments on commit ba3666b

Please sign in to comment.