Proper marquee. Line endings??? Uhhhh....layout. I forgor.
Some checks failed
/ deploy (push) Failing after 1m30s
Some checks failed
/ deploy (push) Failing after 1m30s
This commit is contained in:
parent
9f3351292b
commit
e3ce3c90c7
14 changed files with 285 additions and 256 deletions
|
@ -6,6 +6,19 @@ export const marquee_container = style({
|
||||||
height: 'max-content',
|
height: 'max-content',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
backgroundColor: 'black',
|
backgroundColor: 'black',
|
||||||
|
fontSize: '0.75em',
|
||||||
|
'@media': {
|
||||||
|
'screen and (min-width: 768px)': {
|
||||||
|
fontSize: '1em',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const marquee_sneaky = style({
|
||||||
|
position: 'absolute',
|
||||||
|
visibility: 'hidden',
|
||||||
|
whiteSpace: 'pre',
|
||||||
|
width: 'max-content',
|
||||||
});
|
});
|
||||||
|
|
||||||
const scroll_marquee = keyframes({
|
const scroll_marquee = keyframes({
|
||||||
|
@ -15,16 +28,11 @@ const scroll_marquee = keyframes({
|
||||||
|
|
||||||
export const marquee_content = style({
|
export const marquee_content = style({
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
fontSize: '0.75em',
|
|
||||||
color: 'magenta',
|
color: 'magenta',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'pre',
|
||||||
|
width: 'max-content',
|
||||||
animationName: scroll_marquee,
|
animationName: scroll_marquee,
|
||||||
animationDuration: '8s',
|
animationDuration: '2s',
|
||||||
animationTimingFunction: 'linear',
|
animationTimingFunction: 'linear',
|
||||||
animationIterationCount: 'infinite',
|
animationIterationCount: 'infinite',
|
||||||
'@media': {
|
|
||||||
'screen and (min-width: 768px)': {
|
|
||||||
fontSize: '1em',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,47 @@
|
||||||
import {
|
'use client'
|
||||||
marquee_container,
|
|
||||||
marquee_content,
|
import { useRef, useEffect, useLayoutEffect } from 'react';
|
||||||
} from './Marquee.css';
|
|
||||||
|
import * as style from './Marquee.css';
|
||||||
|
|
||||||
export default function Marquee({ children }: { children: React.ReactNode }) {
|
export default function Marquee({ children }: { children: React.ReactNode }) {
|
||||||
|
const target_ref = useRef<HTMLDivElement | null>(null);
|
||||||
|
const scroll_ref = useRef<HTMLDivElement | null>(null);
|
||||||
|
const sneaky_ref = useRef<HTMLParagraphElement | null>(null);
|
||||||
|
const not_so_sneaky_ref = useRef<HTMLParagraphElement | null>(null);
|
||||||
|
|
||||||
|
function expand_content() {
|
||||||
|
function strip_px(px: string) {
|
||||||
|
return Number(px.substring(0, px.length - 2));
|
||||||
|
}
|
||||||
|
const text = `${children}`;
|
||||||
|
let content = text;
|
||||||
|
const sneaky_width = strip_px(window.getComputedStyle(sneaky_ref.current!).getPropertyValue("width"));
|
||||||
|
let target_width = strip_px(window.getComputedStyle(target_ref.current!).getPropertyValue("width"));
|
||||||
|
while (target_width > 0) {
|
||||||
|
content += text;
|
||||||
|
target_width -= sneaky_width;
|
||||||
|
}
|
||||||
|
scroll_ref.current!.style.width = `${sneaky_width}px`;
|
||||||
|
not_so_sneaky_ref.current!.textContent = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
useLayoutEffect(expand_content);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.addEventListener("resize", expand_content);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", expand_content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={marquee_container}>
|
<div ref={target_ref} className={style.marquee_container}>
|
||||||
<p className={marquee_content}>{children}</p>
|
<p ref={sneaky_ref} className={style.marquee_sneaky}>{children}</p>
|
||||||
<p className={marquee_content}>{children}</p>
|
<div ref={scroll_ref}>
|
||||||
|
<p ref={not_so_sneaky_ref} className={style.marquee_content}></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
17
src/app/airstrip_one/0/layout.css.ts
Normal file
17
src/app/airstrip_one/0/layout.css.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
|
export const center_vertical = style({
|
||||||
|
position: 'relative',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
margin: 'auto',
|
||||||
|
width: '100%',
|
||||||
|
border: '0.3em solid purple',
|
||||||
|
'@media': {
|
||||||
|
'screen and (min-width: 768px)': {
|
||||||
|
width: '50%',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
13
src/app/airstrip_one/0/layout.tsx
Normal file
13
src/app/airstrip_one/0/layout.tsx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import Marquee from './components/Marquee';
|
||||||
|
|
||||||
|
import * as style from './layout.css';
|
||||||
|
|
||||||
|
export default function ExcellentLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<div className={style.center_vertical}>
|
||||||
|
<Marquee>THE SNACK IS WATCHING YOU </Marquee>
|
||||||
|
{children}
|
||||||
|
<Marquee>THE SNACK IS WATCHING YOU </Marquee>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useLayoutEffect, useRef } from 'react';
|
import { useRef, useEffect, useLayoutEffect } from 'react';
|
||||||
import { useSearchParams } from 'next/navigation';
|
import { useSearchParams } from 'next/navigation';
|
||||||
|
|
||||||
import comic_sans from '../../../../comic.ts';
|
import comic_sans from '../../../../comic.ts';
|
||||||
|
@ -25,6 +25,19 @@ export default function Input() {
|
||||||
?? 'At the apex of the pyramid comes Big Brother. Big Brother is infallible and all-powerful. Every success, every achievement, every victory, every scientific discovery, all knowledge, all wisdom, all happiness, all virtue, are held to issue directly from his leadership and inspiration.'
|
?? 'At the apex of the pyramid comes Big Brother. Big Brother is infallible and all-powerful. Every success, every achievement, every victory, every scientific discovery, all knowledge, all wisdom, all happiness, all virtue, are held to issue directly from his leadership and inspiration.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function resize_handler() {
|
||||||
|
input_ref.current!.style.height = "";
|
||||||
|
input_ref.current!.style.height = `${input_ref.current!.scrollHeight}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("resize", resize_handler);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("resize", resize_handler);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
set_message(message);
|
set_message(message);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
import { keyframes, style } from "@vanilla-extract/css";
|
import { keyframes, style } from "@vanilla-extract/css";
|
||||||
|
|
||||||
export const center_vertical = style({
|
|
||||||
boxSizing: 'border-box',
|
|
||||||
position: 'relative',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
alignItems: 'center',
|
|
||||||
margin: 'auto',
|
|
||||||
width: '100%',
|
|
||||||
border: '0.3em solid purple',
|
|
||||||
'@media': {
|
|
||||||
'screen and (min-width: 768px)': {
|
|
||||||
width: '50%',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const border = style({
|
export const border = style({
|
||||||
width: '61%',
|
width: '61%',
|
||||||
marginBottom: '4em',
|
marginBottom: '4em',
|
||||||
|
|
|
@ -1,26 +1,17 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import BeegText from '../components/BeegText';
|
import BeegText from '../components/BeegText';
|
||||||
import Marquee from '../components/Marquee';
|
|
||||||
import Input from './components/Input';
|
import Input from './components/Input';
|
||||||
import {
|
import * as style from './page.css';
|
||||||
center_vertical,
|
|
||||||
border,
|
|
||||||
big_brother_style,
|
|
||||||
} from './page.css';
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return <>
|
||||||
<div className={center_vertical}>
|
|
||||||
<Marquee>THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU </Marquee>
|
|
||||||
<BeegText>THE MINISTRY OF TRUTH</BeegText>
|
<BeegText>THE MINISTRY OF TRUTH</BeegText>
|
||||||
<div className={border}>
|
<div className={style.border}>
|
||||||
<Image className={big_brother_style} width={400} height={300} src='/big_brother_screen.gif' alt='Big Brother' />
|
<Image className={style.big_brother_style} width={400} height={300} src='/big_brother_screen.gif' alt='Big Brother' />
|
||||||
<React.Suspense>
|
<React.Suspense>
|
||||||
<Input />
|
<Input />
|
||||||
</React.Suspense>
|
</React.Suspense>
|
||||||
</div>
|
</div>
|
||||||
<Marquee>THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU </Marquee>
|
</>;
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,5 @@
|
||||||
import { keyframes, style } from "@vanilla-extract/css";
|
import { keyframes, style } from "@vanilla-extract/css";
|
||||||
|
|
||||||
export const center_vertical = style({
|
|
||||||
position: 'relative',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
alignItems: 'center',
|
|
||||||
margin: 'auto',
|
|
||||||
width: '100%',
|
|
||||||
border: '0.3em solid purple',
|
|
||||||
'@media': {
|
|
||||||
'screen and (min-width: 768px)': {
|
|
||||||
width: '50%',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export const big_brother_style = style({
|
export const big_brother_style = style({
|
||||||
width: '60%',
|
width: '60%',
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
|
|
@ -1,41 +1,29 @@
|
||||||
import { Metadata } from 'next'
|
import { Metadata } from 'next';
|
||||||
import Image from 'next/image'
|
import Image from 'next/image';
|
||||||
import Marquee from './components/Marquee'
|
import BeegText from './components/BeegText';
|
||||||
import BeegText from './components/BeegText'
|
import * as style from './page.css';
|
||||||
import {
|
|
||||||
center_vertical,
|
|
||||||
big_brother_style,
|
|
||||||
cats_div,
|
|
||||||
subcats_div,
|
|
||||||
reverse_subcats_div,
|
|
||||||
cat,
|
|
||||||
} from './page.css'
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'The Snack is Watching You',
|
title: 'The Snack is Watching You',
|
||||||
description: 'The Snack is Watching You',
|
description: 'The Snack is Watching You',
|
||||||
}
|
};
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return <>
|
||||||
<div className={center_vertical}>
|
|
||||||
<Marquee>THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU </Marquee>
|
|
||||||
<BeegText>THE SNACK IS</BeegText>
|
<BeegText>THE SNACK IS</BeegText>
|
||||||
<Image className={big_brother_style} width={256} height={256} src='/big_brother.png' alt='Big Brother' />
|
<Image className={style.big_brother_style} width={256} height={256} src='/big_brother.png' alt='Big Brother' />
|
||||||
<BeegText>WATCHING YOU</BeegText>
|
<BeegText>WATCHING YOU</BeegText>
|
||||||
<div className={cats_div}>
|
<div className={style.cats_div}>
|
||||||
<div className={subcats_div}>
|
<div className={style.subcats_div}>
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
</div>
|
</div>
|
||||||
<div className={reverse_subcats_div}>
|
<div className={style.reverse_subcats_div}>
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
<Image className={cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
<Image className={style.cat} width={128} height={128} src='/praising_cat.gif' alt='Cat praising Big Brother' />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Marquee>THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU THE SNACK IS WATCHING YOU </Marquee>
|
</>;
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,7 @@ const comic_sans = localFont({
|
||||||
weight: '100',
|
weight: '100',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={comic_sans.className}>{children}</body>
|
<body className={comic_sans.className}>{children}</body>
|
||||||
|
|
Loading…
Reference in a new issue