Skip to content

Commit

Permalink
Merge pull request #41 from NekoAria/main
Browse files Browse the repository at this point in the history
  • Loading branch information
electh authored Mar 24, 2024
2 parents 26cb3be + 4da3120 commit 7dc7757
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}

.entry-panel {
padding: 7px 25px 34px 25px !important;
padding: 10px !important;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/Main/Main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
background-color: var(--color-fill-1);
padding-top: 49px;
padding-left: 240px;
height: calc(100vh - 49px);
display: flex;
transition:
padding-left 0.1s linear,
Expand Down
22 changes: 20 additions & 2 deletions src/components/Main/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Select,
Switch,
} from "@arco-design/web-react";
import { useState } from "react";
import { useEffect, useState } from "react";
import { Outlet } from "react-router-dom";

import useStore from "../../Store";
Expand All @@ -22,6 +22,24 @@ const Main = () => {
const activeContent = useStore((state) => state.activeContent);
const setActiveContent = useStore((state) => state.setActiveContent);

useEffect(() => {
const updateHeight = () => {
const entryPanel = document.querySelector(".entry-panel");
const entryPanelHeight = entryPanel ? entryPanel.offsetHeight : 0;
const viewportHeight = window.innerHeight;
const adjustedHeight = viewportHeight - entryPanelHeight;
document.documentElement.style.setProperty(
"--dynamic-viewport-height",
`${adjustedHeight}px`,
);
};

window.addEventListener("resize", updateHeight);
updateHeight();

return () => window.removeEventListener("resize", updateHeight);
}, []);

const SettingsModal = () => (
<Modal
visible={visible.settings}
Expand Down Expand Up @@ -119,7 +137,7 @@ const Main = () => {
};

return (
<div className="main">
<div className="main" style={{ height: "var(--dynamic-viewport-height)" }}>
<Outlet />
<SettingsModal />
<AddFeedModal />
Expand Down

0 comments on commit 7dc7757

Please sign in to comment.