This repository was archived by the owner on Jan 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +70
-14
lines changed Expand file tree Collapse file tree 6 files changed +70
-14
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,17 @@ You can configure a few things by editing the file `src/config/index.tsx`.
21
21
- ` POLL_INTERVAL ` - How often should the frontend look for updates. Default 5 seconds.
22
22
- ` FILE_EXTENSION ` - The filetypes supported. Default ` png ` .
23
23
- ` FILE_MIME ` - The file mime type. Default ` image/png ` .
24
- - ` SHOW_TITLE ` - If the title should be overlaid. Default ` true ` .
25
- - ` MAX_WIDTH ` - The maximum width of the image column. Default ` 320 ` .
24
+ - ` SHOW_TITLE ` - If the title should be overlaid. Default ` false ` .
25
+ - ` STACK_TRANSFORM ` - How the stack should be positioned on the page. Default shown below.
26
+
27
+ ``` ts
28
+ export const STACK_TRANSFORM = {
29
+ x: " 100%" ,
30
+ y: 0 ,
31
+ width: 256 ,
32
+ height: 1265 ,
33
+ rotation: 90 ,
34
+ };
35
+ ```
26
36
27
37
You can also adjust the title field formatter here: ` src/utils/images.ts ` .
Original file line number Diff line number Diff line change 1
1
/* eslint-disable @next/next/no-img-element */
2
2
import { getTitle } from "@/utils/images" ;
3
- import { MAX_WIDTH , SHOW_TITLE } from "@/config" ;
3
+ import { SHOW_TITLE } from "@/config" ;
4
4
5
5
import styles from "./ImageStack.module.css" ;
6
6
@@ -9,12 +9,7 @@ interface Props {
9
9
}
10
10
11
11
export const ImageStack = ( { images = [ ] } : Props ) => (
12
- < ul
13
- className = { styles . list }
14
- style = { {
15
- maxWidth : MAX_WIDTH ,
16
- } }
17
- >
12
+ < ul className = { styles . list } >
18
13
{ images . map ( ( image ) => (
19
14
< li key = { image } >
20
15
{ SHOW_TITLE && < h2 > { getTitle ( image ) } </ h2 > }
Original file line number Diff line number Diff line change
1
+ .main {
2
+ display : block;
3
+ position : absolute;
4
+ z-index : 100px ;
5
+ overflow : hidden;
6
+ transform-origin : top left;
7
+ width : 100% ;
8
+ }
Original file line number Diff line number Diff line change
1
+ import { ReactNode } from "react" ;
2
+
3
+ import styles from "./Positioner.module.css" ;
4
+
5
+ interface Position {
6
+ x ?: string | number ;
7
+ y ?: string | number ;
8
+ width ?: string | number ;
9
+ height ?: string | number ;
10
+ rotation ?: number ;
11
+ }
12
+
13
+ interface Props extends Position {
14
+ children ?: ReactNode ;
15
+ }
16
+
17
+ export const Positioner = ( { children, ...position } : Props ) => (
18
+ < div
19
+ className = { styles . main }
20
+ style = { {
21
+ left : position . x ,
22
+ top : position . y ,
23
+ width : position . width ,
24
+ height : position . height ,
25
+ transform : `rotate(${ position . rotation } deg)` ,
26
+ } }
27
+ >
28
+ { children }
29
+ </ div >
30
+ ) ;
Original file line number Diff line number Diff line change @@ -3,5 +3,12 @@ export const MAX_IMAGES = 10;
3
3
export const POLL_INTERVAL = 5 * 1000 ;
4
4
export const FILE_EXTENSION = "png" ;
5
5
export const FILE_MIME = "image/png" ;
6
- export const SHOW_TITLE = true ;
7
- export const MAX_WIDTH = 320 ;
6
+ export const SHOW_TITLE = false ;
7
+
8
+ export const STACK_TRANSFORM = {
9
+ x : "100%" ,
10
+ y : 0 ,
11
+ width : 256 ,
12
+ height : 1265 ,
13
+ rotation : 90 ,
14
+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import Head from "next/head";
5
5
import type { NextPage } from "next" ;
6
6
7
7
import useImages from "@/hooks/useImages" ;
8
+ import { STACK_TRANSFORM } from "@/config" ;
9
+ import { Positioner } from "@/components/Positioner" ;
8
10
import { ImageStack } from "@/components/ImageStack" ;
9
11
10
12
const Home : NextPage = ( ) => {
@@ -14,12 +16,16 @@ const Home: NextPage = () => {
14
16
target : fullscreenContainerRef ,
15
17
} ) ;
16
18
return (
17
- < div ref = { fullscreenContainerRef } onClick = { toggleFullscreen } >
19
+ < >
18
20
< Head >
19
21
< title > Phantom Diffusion</ title >
20
22
</ Head >
21
- < ImageStack images = { images } />
22
- </ div >
23
+ < div ref = { fullscreenContainerRef } onClick = { toggleFullscreen } >
24
+ < Positioner { ...STACK_TRANSFORM } >
25
+ < ImageStack images = { images } />
26
+ </ Positioner >
27
+ </ div >
28
+ </ >
23
29
) ;
24
30
} ;
25
31
You can’t perform that action at this time.
0 commit comments