-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support sidebar on either side (or none)
- Loading branch information
Showing
3 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
<script setup lang="ts"> | ||
import { computed, useSlots } from "vue"; | ||
const slots = useSlots(); | ||
const hasLeftSidebar = computed(() => { | ||
return !!slots.leftSidebar; | ||
}); | ||
const hasRightSidebar = computed(() => { | ||
return !!slots.rightSidebar; | ||
}); | ||
</script> | ||
<template> | ||
<div class="flex w-full"> | ||
<!-- Left sidebar --> | ||
<div class="w-1/4 p-4 overflow-y-auto"> | ||
<slot name="sidebar"></slot> | ||
<div v-if="hasLeftSidebar" class="w-1/4 p-4 overflow-y-auto"> | ||
<slot name="leftSidebar"></slot> | ||
</div> | ||
|
||
<!-- Right side content --> | ||
<div class="w-3/4 p-4 overflow-y-auto"> | ||
<!-- Left side content --> | ||
<div class="flex-1 p-4 overflow-y-auto"> | ||
<slot name="content"></slot> | ||
</div> | ||
<!-- Right sidebar --> | ||
<div v-if="hasRightSidebar" class="w-1/4 p-4 overflow-y-auto"> | ||
<slot name="rightSidebar"></slot> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters