mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-17 06:00:20 +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,18 +163,25 @@ export const DefaultLayout = () => {
|
|||||||
/>
|
/>
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
</SidebarContainer>
|
</SidebarContainer>
|
||||||
<RightSidebarContainer>
|
{sidebar.rightExpanded && (
|
||||||
<ResizeHandle
|
<RightSidebarContainer
|
||||||
ref={rightSidebarRef}
|
key="sb"
|
||||||
isResizing={isResizingRight}
|
animate={{ opacity: 1, scale: 1, x: 0 }}
|
||||||
placement="left"
|
initial={{ opacity: 0, x: 500 }}
|
||||||
onMouseDown={(e) => {
|
transition={{ duration: 0.3, ease: 'circOut' }}
|
||||||
e.preventDefault();
|
>
|
||||||
startResizing('right');
|
<ResizeHandle
|
||||||
}}
|
ref={rightSidebarRef}
|
||||||
/>
|
isResizing={isResizingRight}
|
||||||
{sidebar.rightExpanded && <SideQueue />}
|
placement="left"
|
||||||
</RightSidebarContainer>
|
onMouseDown={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
startResizing('right');
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<SideQueue />
|
||||||
|
</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