| 1 | <!-- |
| 2 | Usage: |
| 3 | ```md |
| 4 | --- |
| 5 | layout: two-cols-header |
| 6 | --- |
| 7 | This spans both |
| 8 | ::left:: |
| 9 | # Left |
| 10 | This shows on the left |
| 11 | ::right:: |
| 12 | # Right |
| 13 | This shows on the right |
| 14 | ::bottom:: |
| 15 | This shows at the bottom, aligned to the end (bottom) of the grid |
| 16 | |
| 17 | <style> |
| 18 | .two-cols-header { |
| 19 | column-gap: 20px; /* Adjust the gap size as needed */ |
| 20 | } |
| 21 | </style> |
| 22 | ``` |
| 23 | --> |
| 24 | |
| 25 | <script setup lang="ts"> |
| 26 | const props = defineProps({ |
| 27 | class: { |
| 28 | type: String, |
| 29 | }, |
| 30 | layoutClass: { |
| 31 | type: String, |
| 32 | }, |
| 33 | }) |
| 34 | </script> |
| 35 | |
| 36 | <template> |
| 37 | <div class="slidev-layout two-cols-header w-full h-full" :class="layoutClass"> |
| 38 | <div class="col-header"> |
| 39 | <slot /> |
| 40 | </div> |
| 41 | <div class="col-left" :class="props.class"> |
| 42 | <slot name="left" /> |
| 43 | </div> |
| 44 | <div class="col-right" :class="props.class"> |
| 45 | <slot name="right" /> |
| 46 | </div> |
| 47 | <div class="col-bottom" :class="props.class"> |
| 48 | <slot name="bottom" /> |
| 49 | </div> |
| 50 | </div> |
| 51 | </template> |
| 52 | |
| 53 | <style scoped> |
| 54 | .two-cols-header { |
| 55 | display: grid; |
| 56 | grid-template-columns: repeat(2, 1fr); |
| 57 | grid-template-rows: auto 1fr auto; |
| 58 | } |
| 59 | |
| 60 | .col-header { |
| 61 | grid-area: 1 / 1 / 2 / 3; |
| 62 | } |
| 63 | .col-left { |
| 64 | grid-area: 2 / 1 / 3 / 2; |
| 65 | } |
| 66 | .col-right { |
| 67 | grid-area: 2 / 2 / 3 / 3; |
| 68 | } |
| 69 | .col-bottom { |
| 70 | align-self: end; |
| 71 | grid-area: 3 / 1 / 3 / 3; |
| 72 | } |
| 73 | </style> |
| 74 |