이런 인사이트는 어때요?
diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx
index cf66370..c3ade98 100644
--- a/src/components/layout/Layout.tsx
+++ b/src/components/layout/Layout.tsx
@@ -13,7 +13,7 @@ const Layout = () => {
const isSideBarOpen = useRecoilValue(isSideBarOpenState);
const isShowFooter = useMemo(
- () => ['/'].includes(pathname) || /^\/category/g.test(pathname),
+ () => /^(\/|\/category|\/guide)/g.test(pathname),
[pathname],
);
@@ -21,10 +21,12 @@ const Layout = () => {
<>
-
+
{isSideBarOpen &&
}
-
+
+
+
{isShowFooter &&
}
diff --git a/src/components/layout/footer/Footer.tsx b/src/components/layout/footer/Footer.tsx
index 7df102f..08f93d2 100644
--- a/src/components/layout/footer/Footer.tsx
+++ b/src/components/layout/footer/Footer.tsx
@@ -3,13 +3,10 @@ import AboutViNO from './AboutViNO';
import SendEmail from './SendEmail';
import FooterLogo from '@/assets/logo-footer.png';
-import { isSideBarOpenState } from '@/stores/ui';
-import { useRecoilValue } from 'recoil';
const Footer = () => {
- const isSideBarOpen = useRecoilValue(isSideBarOpenState);
return (
-
+
diff --git a/src/components/layout/header/index.tsx b/src/components/layout/header/index.tsx
index 48fe526..d2bf1f4 100644
--- a/src/components/layout/header/index.tsx
+++ b/src/components/layout/header/index.tsx
@@ -22,15 +22,13 @@ const Header = () => {
const [isSideBarOpen, setIsSideBarOpen] = useRecoilState(isSideBarOpenState);
const [isDarkSection, setIsDarkSection] = useState(false);
- const isDark = ['/'].includes(pathname) && isDarkSection;
-
const observer = useMemo(() => {
return new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
- const { height, y } = entry.boundingClientRect;
+ const { isIntersecting } = entry;
- setIsDarkSection(!(y < height * -0.9));
+ setIsDarkSection(isIntersecting);
});
},
{ threshold: 0.1 },
@@ -44,7 +42,11 @@ const Header = () => {
useEffect(() => {
const darkSectionList = document.querySelectorAll('.dark-section') || [];
- darkSectionList.forEach((el) => observer.observe(el));
+ if (darkSectionList.length) {
+ darkSectionList.forEach((el) => observer.observe(el));
+ } else {
+ setIsDarkSection(false);
+ }
return () => {
observer.disconnect();
@@ -54,12 +56,11 @@ const Header = () => {
return (