File tree Expand file tree Collapse file tree 6 files changed +27
-9
lines changed Expand file tree Collapse file tree 6 files changed +27
-9
lines changed Original file line number Diff line number Diff line change 1+ import { Outlet , ScrollRestoration } from "react-router-dom" ;
2+
3+ export const Layout = ( ) => {
4+ return (
5+ < div >
6+ < Outlet />
7+ < ScrollRestoration />
8+ </ div >
9+ ) ;
10+ } ;
Original file line number Diff line number Diff line change 11import { createBrowserRouter , RouterProvider } from "react-router-dom" ;
22import { ItemsIndex } from "../pages/items" ;
33import { ItemsShow } from "../pages/items/show" ;
4+ import { Layout } from "./Layout" ;
45
56const router = createBrowserRouter ( [
67 {
78 path : "/" ,
8- element : < ItemsIndex /> ,
9- } ,
10- {
11- path : "/items/:id" ,
12- element : < ItemsShow /> ,
9+ element : < Layout /> ,
10+ children : [
11+ {
12+ index : true ,
13+ element : < ItemsIndex /> ,
14+ } ,
15+ {
16+ path : "/items/:id" ,
17+ element : < ItemsShow /> ,
18+ } ,
19+ ] ,
1320 } ,
1421] ) ;
1522
Original file line number Diff line number Diff line change @@ -694,6 +694,8 @@ const closedSidebarStyle = css({
694694 justifyContent : "space-between" ,
695695 maxWidth : 48 ,
696696 padding : `${ getSpace ( 1 ) } px ${ getSpace ( 1 / 2 ) } px ${ getSpace ( 2 ) } px` ,
697+ position : "sticky" ,
698+ top : 0 ,
697699
698700 ...viewport . S ( {
699701 display : "none" ,
Original file line number Diff line number Diff line change @@ -11,7 +11,5 @@ export const Contents = ({ children }: Props) => {
1111
1212const contentsStyle = css ( {
1313 gridArea : "contents" ,
14- height : "100vh" ,
15- overflowX : "auto" ,
1614 width : "100%" ,
1715} ) ;
Original file line number Diff line number Diff line change @@ -18,9 +18,8 @@ const mainStyle = css({
1818 "sidebar contents"
1919 ` ,
2020 gridTemplateColumns : "auto minmax(450px, 1fr)" ,
21- height : "100vh" ,
2221
2322 ...viewport . S ( {
24- gridTemplateColumns : "auto 1fr" ,
23+ gridTemplateColumns : "auto minmax(0, 1fr)" , // Setting min width to prevent widening
2524 } ) ,
2625} ) ;
Original file line number Diff line number Diff line change @@ -14,4 +14,6 @@ export const Sidebar = ({ children }: Props) => {
1414const sidebarStyle = css ( {
1515 backgroundColor : Colors . gray0 ,
1616 gridArea : "sidebar" ,
17+ position : "sticky" ,
18+ zIndex : 1 ,
1719} ) ;
You can’t perform that action at this time.
0 commit comments