S
SolidJS2d ago
tizu

router: "background" page

Hello everyone, I am trying to recreate this effect. My main issue at the moment is that I need the back button to function as a back button, so I'm not sure how I could do this. specifically, I need to be able to open the route that's in the drawer while keeping the old one in the background, if that makes any sense. I hope the video explains. thanks!
18 Replies
Brendonovich
Brendonovich2d ago
i don't think solid router has the features to do this nicely, but a more hacky way might be implementing the whole chat route in a layout and making the page essentially just be empty, then implementing the modal in another route within that layout
tizu
tizuOP2d ago
hmmmm not sure if I like that; that won't really work with the drawer then no?
Brendonovich
Brendonovich2d ago
oh i meant drawer sorry so you'd have
/chat - implement all the chat ui
/ - blank
/attach - drawer
/chat - implement all the chat ui
/ - blank
/attach - drawer
tizu
tizuOP2d ago
okay well actually wait, I should clarify
tizu
tizuOP2d ago
I more or less want the drawer to be present at all times (apple shortcuts style). once you actually interact with it (so that it becomes modal and you cant interact with the background) it should use the other route. so its more like that I want to share the component with the route, but have different state I guess?
No description
Brendonovich
Brendonovich2d ago
hmmm that's kinda getting into parallel routes territory which solid router doesn't support yet, i think i'd just bail out of routing and manage the route state myself for that drawer
tizu
tizuOP2d ago
yeah, it kinda is parallel routes :)
Brendonovich
Brendonovich2d ago
unless that persistent bit was also part of the layout and the content below was the children, idk
tizu
tizuOP2d ago
I mean okay this is quite a hack I guess but could I have the entire ui, including drawer, be in a layout, and then the drawer state is inferred by the actual route?
Brendonovich
Brendonovich2d ago
yeah i think that's what i meant if you don't have other stuff you'd need as children it could work
tizu
tizuOP2d ago
not sure I understand? what do you mean
Brendonovich
Brendonovich2d ago
by 'inferred by the actual route' i assume that the props.children of the layout would be the drawer contents
tizu
tizuOP2d ago
oh like that wait actually thats smart i think
Brendonovich
Brendonovich2d ago
it could work but if you needed any non-drawer routes i don't think it's an option
tizu
tizuOP2d ago
I mean thats a stretch, but my idea was kinda that (aside from the root ui) everything would be either outside or inside that drawer; but the drawer would also have navigation inside it so for example settings pages would be in that drawer, going back goes back a settings page, or you could dismiss it entirely by swiping down
Brendonovich
Brendonovich2d ago
i guess you could just do it and pray you don't need any other routes until parallel routes get implemented haha
tizu
tizuOP2d ago
https://github.com/solidjs/solid-router/pull/426 oh lmao did you pr parallel routes
GitHub
Parallel Routes by Brendonovich · Pull Request #426 · solidjs/solid...
This PR adds basic support for Parallel Routes, a feature I've only seen in Next.js. The following is my reasoning for why Solid Router should support them, but I think Next and this Remix ...
Brendonovich
Brendonovich2d ago
yea they're not ready to ship tho worked great for us implementing breadcrumbs haha

Did you find this page helpful?