From c27302d9458604e3280b625a9af6375130f39282 Mon Sep 17 00:00:00 2001
From: MooKorea <69235304+MooKorea@users.noreply.github.com>
Date: Tue, 29 Aug 2023 15:21:53 -0500
Subject: [PATCH] layout fixes
---
src/assets/components/Navbar.jsx | 13 +-
src/assets/pages/features/Section.jsx | 193 +++++++++++++++-----------
src/assets/styles/documentation.scss | 2 -
src/assets/styles/features.scss | 31 ++++-
4 files changed, 149 insertions(+), 90 deletions(-)
diff --git a/src/assets/components/Navbar.jsx b/src/assets/components/Navbar.jsx
index 1987e5f..3837d62 100644
--- a/src/assets/components/Navbar.jsx
+++ b/src/assets/components/Navbar.jsx
@@ -16,13 +16,14 @@ export default function Navbar() {
const [isOpened, setIsOpened] = useState(false);
- const handleDropDownState = (e) => {
- if (isOpened && !e.target.closest(".collapse-button")) {
- setIsOpened(false);
- }
- };
-
+
useEffect(() => {
+ const handleDropDownState = (e) => {
+ // console.log(e.target)
+ if (isOpened && !e.target.closest(".collapse-button")) {
+ setIsOpened(false);
+ }
+ };
window.addEventListener("click", handleDropDownState);
return () => window.removeEventListener("click", handleDropDownState);
}, []);
diff --git a/src/assets/pages/features/Section.jsx b/src/assets/pages/features/Section.jsx
index 121e3c4..0203e5e 100644
--- a/src/assets/pages/features/Section.jsx
+++ b/src/assets/pages/features/Section.jsx
@@ -1,6 +1,6 @@
-import React, { useEffect, useState } from "react";
+import React, { useEffect, useState, useRef } from "react";
import parse from "html-react-parser";
-import { motion, AnimatePresence } from "framer-motion";
+import { motion, AnimatePresence, useAnimation } from "framer-motion";
import useMeasure from "react-use-measure";
export default function Section({ data }) {
@@ -8,6 +8,8 @@ export default function Section({ data }) {
const [images, setImages] = useState([]);
const [content, setContent] = useState();
const [current, setCurrent] = useState(0);
+ const [isFullScreen, setIsFullScreen] = useState(false);
+ const [emptyContainerHeight, setEmptyContainerHeight] = useState(0);
useEffect(() => {
setContent(parse(data, parseText));
@@ -47,101 +49,130 @@ export default function Section({ data }) {
}
};
- const [isMissingImage, setIsMissingImage] = useState(false)
+ const [isMissingImage, setIsMissingImage] = useState(false);
const [direction, setDirection] = useState("100%");
const handleSlide = (add) => {
- setIsMissingImage(false)
+ setIsMissingImage(false);
setCurrent((prev) => (prev + add) % carousel.length);
add === 1 ? setDirection("100%") : setDirection("-100%");
};
let [ref, { height }] = useMeasure();
+ let containerRef = useRef();
+
+ const controls = useAnimation();
+ const handleFullScreen = () => {
+ setEmptyContainerHeight(containerRef.current.offsetHeight);
+ controls.set({ opacity: 0 });
+ controls.start({ opacity: 1 });
+ setIsFullScreen(!isFullScreen);
+ };
+
+ // useEffect(() => {
+ // console.log(containerRef.current.offsetHeight)
+ // }, [emptyContainerHeight])
return (
<>
{content}
-
- {carousel?.length > 1 && (
-
-
handleSlide(carousel.length - 1)}>
-