Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass class to inner div #38

Open
phhoef opened this issue Dec 31, 2024 · 2 comments
Open

Pass class to inner div #38

phhoef opened this issue Dec 31, 2024 · 2 comments

Comments

@phhoef
Copy link

phhoef commented Dec 31, 2024

I am new to svelte, so maybe it's just a problem of how I use this router.
I am using svelte 5 and shadcn-svelte to build a app with wails3.

I have a sidebar and the router is mounted as inset.

<Sidebar.Provider open={false}>
  <Appbar activeRoute={instance?.current.path.toString() ?? ""} items={routes} {logout} />
    <Sidebar.Inset class="p-2">
      <Router bind:instance {routes} />
    </Sidebar.Inset>
</Sidebar.Provider>

The sidebar is using flex layouts and I noticed, that the div used in the router breaks this layout.
I cannot easily use flex flex-col flex-1 in my children to use the remaining height.
image

Is there a simple way to avoid this problem?

@afreidz
Copy link

afreidz commented Jan 24, 2025

ran into a similar situation might be worth trying to globally target the div and set it to display:contents; i dont have the exact structure but below is an example of what i did with my dom structure. you could do something similar:

<style lang="postcss">
  :global(#app > div:first-of-type) {
    @apply contents;
  }
</style>

@phhoef
Copy link
Author

phhoef commented Jan 25, 2025

thanks for your help! This is a very nice approach ... 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants