@@ -2,6 +2,7 @@ import { WindowEventListener } from "@solid-primitives/event-listener";
22import { createBreakpoints } from "@solid-primitives/media" ;
33import { combineProps } from "@solid-primitives/props" ;
44import { Show , createEffect , createSignal } from "solid-js" ;
5+ import { isServer } from "solid-js/web" ;
56import { IntrinsicComponentProps } from "../types" ;
67import { processProps } from "../utilities" ;
78import LayoutContent from "./content" ;
@@ -57,6 +58,7 @@ function InnerLayout(props: LayoutProps) {
5758 const [ sidebarTransition , setSidebarTransition ] = createSignal ( false ) ;
5859
5960 createEffect ( ( ) => {
61+ if ( isServer ) return ;
6062 setSidebarTransition ( true ) ;
6163
6264 setTimeout ( ( ) => {
@@ -88,7 +90,7 @@ function InnerLayout(props: LayoutProps) {
8890 ? "transform 0.3s var(--jdd-transition-function), opacity 0.3s var(--jdd-transition-function)"
8991 : "" ,
9092 get "--jdd-layout-backdrop-opacity" ( ) {
91- if ( leftSidebarOpen ( ) || rightSidebarOpen ( ) ) {
93+ if ( isServer || leftSidebarOpen ( ) || rightSidebarOpen ( ) ) {
9294 return "" ;
9395 }
9496
@@ -140,13 +142,19 @@ function InnerLayout(props: LayoutProps) {
140142
141143 let swipeDirection : "left" | "right" | undefined ;
142144
143- // Left swipe
144- if ( swipeStart ( ) . x < local . swipeDistanceFromSides ) {
145+ // Swipe from left to right
146+ if (
147+ getSidebarLeft ( ) !== undefined &&
148+ swipeStart ( ) . x < local . swipeDistanceFromSides
149+ ) {
145150 swipeDirection = "right" ;
146151 }
147152
148- // Right swipe
149- if ( window . innerWidth - swipeStart ( ) . x < local . swipeDistanceFromSides ) {
153+ // Swipe from right to left
154+ if (
155+ getSidebarRight ( ) !== undefined &&
156+ window . innerWidth - swipeStart ( ) . x < local . swipeDistanceFromSides
157+ ) {
150158 swipeDirection = "left" ;
151159 }
152160
0 commit comments