PaneLayout.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <Splitpanes
  3. class="smart-splitter"
  4. :rtl="SIDEBAR_ON_LEFT && mdAndLarger"
  5. :class="{
  6. '!flex-row-reverse': SIDEBAR_ON_LEFT && mdAndLarger,
  7. }"
  8. :horizontal="!mdAndLarger"
  9. >
  10. <Pane
  11. size="75"
  12. min-size="65"
  13. class="hide-scrollbar !overflow-auto flex flex-col"
  14. >
  15. <Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
  16. <Pane
  17. :size="COLUMN_LAYOUT ? 45 : 50"
  18. class="hide-scrollbar !overflow-auto flex flex-col"
  19. >
  20. <slot name="primary" />
  21. </Pane>
  22. <Pane
  23. :size="COLUMN_LAYOUT ? 65 : 50"
  24. class="flex flex-col hide-scrollbar !overflow-auto"
  25. >
  26. <slot name="secondary" />
  27. </Pane>
  28. </Splitpanes>
  29. </Pane>
  30. <Pane
  31. v-if="SIDEBAR"
  32. size="25"
  33. min-size="20"
  34. class="hide-scrollbar !overflow-auto flex flex-col"
  35. >
  36. <slot name="sidebar" />
  37. </Pane>
  38. </Splitpanes>
  39. </template>
  40. <script setup lang="ts">
  41. import { Splitpanes, Pane } from "splitpanes"
  42. import "splitpanes/dist/splitpanes.css"
  43. import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
  44. import { useSetting } from "~/newstore/settings"
  45. const SIDEBAR_ON_LEFT = useSetting("SIDEBAR_ON_LEFT")
  46. const breakpoints = useBreakpoints(breakpointsTailwind)
  47. const mdAndLarger = breakpoints.greater("md")
  48. const COLUMN_LAYOUT = useSetting("COLUMN_LAYOUT")
  49. const SIDEBAR = useSetting("SIDEBAR")
  50. </script>