mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-03 03:11:40 +00:00
fix sidebar image height when using Windows or macOS window bar
This commit is contained in:
parent
b989a66991
commit
ac0c396712
2 changed files with 21 additions and 2 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
.image-container {
|
.image-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: var(--sidebar-image-height);
|
||||||
height: var(--sidebar-image-height);
|
height: var(--sidebar-image-height);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
animation: fade-in 0.2s ease-in-out;
|
animation: fade-in 0.2s ease-in-out;
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,18 @@ import {
|
||||||
useSetFullScreenPlayerStore,
|
useSetFullScreenPlayerStore,
|
||||||
useSidebarStore,
|
useSidebarStore,
|
||||||
} from '/@/renderer/store';
|
} from '/@/renderer/store';
|
||||||
import { SidebarItemType, useGeneralSettings } from '/@/renderer/store/settings.store';
|
import {
|
||||||
|
SidebarItemType,
|
||||||
|
useGeneralSettings,
|
||||||
|
useWindowSettings,
|
||||||
|
} from '/@/renderer/store/settings.store';
|
||||||
import { Accordion } from '/@/shared/components/accordion/accordion';
|
import { Accordion } from '/@/shared/components/accordion/accordion';
|
||||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
|
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { Tooltip } from '/@/shared/components/tooltip/tooltip';
|
import { Tooltip } from '/@/shared/components/tooltip/tooltip';
|
||||||
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const Sidebar = () => {
|
export const Sidebar = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
@ -64,6 +69,7 @@ export const Sidebar = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { sidebarItems } = useGeneralSettings();
|
const { sidebarItems } = useGeneralSettings();
|
||||||
|
const { windowBarStyle } = useWindowSettings();
|
||||||
|
|
||||||
const sidebarItemsWithRoute: SidebarItemType[] = useMemo(() => {
|
const sidebarItemsWithRoute: SidebarItemType[] = useMemo(() => {
|
||||||
if (!sidebarItems) return [];
|
if (!sidebarItems) return [];
|
||||||
|
|
@ -80,6 +86,18 @@ export const Sidebar = () => {
|
||||||
return items;
|
return items;
|
||||||
}, [sidebarItems, translatedSidebarItemMap]);
|
}, [sidebarItems, translatedSidebarItemMap]);
|
||||||
|
|
||||||
|
const scrollAreaHeight = useMemo(() => {
|
||||||
|
if (showImage) {
|
||||||
|
if (windowBarStyle === Platform.WINDOWS || windowBarStyle === Platform.MACOS) {
|
||||||
|
return `calc(100% - 105px - ${sidebar.leftWidth})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `calc(100% - ${sidebar.leftWidth})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '100%';
|
||||||
|
}, [showImage, sidebar.leftWidth, windowBarStyle]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.container}
|
className={styles.container}
|
||||||
|
|
@ -95,7 +113,7 @@ export const Sidebar = () => {
|
||||||
allowDragScroll
|
allowDragScroll
|
||||||
className={styles.scrollArea}
|
className={styles.scrollArea}
|
||||||
style={{
|
style={{
|
||||||
maxHeight: showImage ? `calc(100vh - 90px - ${sidebar.leftWidth})` : '100%',
|
height: scrollAreaHeight,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Accordion
|
<Accordion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue