Skip to content

Commit 1977998

Browse files
committed
Use modal instead of inbuilt fullscreen
1 parent 6878599 commit 1977998

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.fullscreen-horizontal {
2+
writing-mode: sideways-rl;
3+
text-orientation: mixed;
4+
word-wrap: break-word;
5+
}
6+
.fullscreen {
7+
display: flex;
8+
justify-content: center;
9+
align-items: center;
10+
height: 100vh;
11+
width: 100vw;
12+
margin: 0;
13+
position: fixed;
14+
}
15+
.hidden {
16+
display: none;
17+
opacity: 0;
18+
}
19+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from "react";
2+
import styles from "./FullscreenModalComponent.module.css";
3+
type Props = {
4+
orientation?: "vertical" | "horizontal",
5+
isFullscreenValue: boolean,
6+
}
7+
export const FullscreenModalComponent: React.FC<React.PropsWithChildren<Props>> = ({
8+
orientation = "vertical",
9+
isFullscreenValue = false,
10+
children
11+
}) => {
12+
return (
13+
<div
14+
className={
15+
[
16+
orientation == "horizontal" && styles["fullscreen-horizontal"],
17+
!isFullscreenValue && styles.hidden,
18+
styles.fullscreen
19+
].join(" ")
20+
}
21+
>
22+
{isFullscreenValue && children}
23+
</div>
24+
);
25+
};

src/app/bigtextconfig/page.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { LargeTextInputComponent } from "./LargeTextInputComponent";
55
import { LargeButtonComponent } from "./LargeButtonComponent";
66
import { LargeTextDisplayComponent } from "@/components/shared/LargeTextDisplayComponent";
77
import { QrComponent } from "./QrComponent";
8-
import { FullscreenComponent } from "./FullscreenComponent";
8+
import { FullscreenModalComponent } from "./FullscreenModalComponent";
99
import styles from "./page.module.css";
1010
export default function Page() {
1111
const [text, setText] = useState("");
@@ -56,9 +56,8 @@ export default function Page() {
5656
</div>
5757
</div>
5858
</div>
59-
<FullscreenComponent
59+
<FullscreenModalComponent
6060
isFullscreenValue={isFullscreen}
61-
updateFullscreenState={setFullscreen}
6261
orientation={orientation}
6362
>
6463
{fullscreenContent === "text" ?
@@ -86,6 +85,6 @@ export default function Page() {
8685
<Image src="/cross.svg" alt="close" width={100} height={100} />
8786
</LargeButtonComponent>
8887
</div>
89-
</FullscreenComponent>
88+
</FullscreenModalComponent>
9089
</div>);
9190
};

0 commit comments

Comments
 (0)