mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-15 16:04:19 +02:00
Handle right sidebar
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Menu, Button } from '@mantine/core';
|
import { Menu, Button } from '@mantine/core';
|
||||||
|
import { motion } from 'framer-motion';
|
||||||
import { Outlet } from 'react-router';
|
import { Outlet } from 'react-router';
|
||||||
import { SideQueue } from '@/renderer/features/side-queue/components/SideQueue';
|
import { SideQueue } from '@/renderer/features/side-queue/components/side-queue';
|
||||||
import { Titlebar } from '@/renderer/features/titlebar/components/titlebar';
|
import { Titlebar } from '@/renderer/features/titlebar/components/titlebar';
|
||||||
import { useAppStore } from '@/renderer/store';
|
import { useAppStore } from '@/renderer/store';
|
||||||
import {
|
import {
|
||||||
@@ -51,7 +52,7 @@ const SidebarContainer = styled.div`
|
|||||||
background: var(--sidebar-bg);
|
background: var(--sidebar-bg);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const RightSidebarContainer = styled.div`
|
const RightSidebarContainer = styled(motion.div)`
|
||||||
position: relative;
|
position: relative;
|
||||||
grid-area: right-sidebar;
|
grid-area: right-sidebar;
|
||||||
background: var(--sidebar-bg);
|
background: var(--sidebar-bg);
|
||||||
@@ -162,7 +163,13 @@ export const DefaultLayout = () => {
|
|||||||
/>
|
/>
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
</SidebarContainer>
|
</SidebarContainer>
|
||||||
<RightSidebarContainer>
|
{sidebar.rightExpanded && (
|
||||||
|
<RightSidebarContainer
|
||||||
|
key="sb"
|
||||||
|
animate={{ opacity: 1, scale: 1, x: 0 }}
|
||||||
|
initial={{ opacity: 0, x: 500 }}
|
||||||
|
transition={{ duration: 0.3, ease: 'circOut' }}
|
||||||
|
>
|
||||||
<ResizeHandle
|
<ResizeHandle
|
||||||
ref={rightSidebarRef}
|
ref={rightSidebarRef}
|
||||||
isResizing={isResizingRight}
|
isResizing={isResizingRight}
|
||||||
@@ -172,8 +179,9 @@ export const DefaultLayout = () => {
|
|||||||
startResizing('right');
|
startResizing('right');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{sidebar.rightExpanded && <SideQueue />}
|
<SideQueue />
|
||||||
</RightSidebarContainer>
|
</RightSidebarContainer>
|
||||||
|
)}
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</MainContainer>
|
</MainContainer>
|
||||||
<PlayerbarContainer>
|
<PlayerbarContainer>
|
||||||
|
|||||||
@@ -9,3 +9,15 @@ export const constrainSidebarWidth = (num: number) => {
|
|||||||
|
|
||||||
return num;
|
return num;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const constrainRightSidebarWidth = (num: number) => {
|
||||||
|
if (num < 250) {
|
||||||
|
return 250;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num > 960) {
|
||||||
|
return 960;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user