Skip to content

Commit 7c845a4

Browse files
committed
Add an example panel component
1 parent 8afc65a commit 7c845a4

File tree

5 files changed

+125
-3
lines changed

5 files changed

+125
-3
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<script setup lang="ts">
2+
import MyPanelSection from './MyPanelSection.vue'
3+
4+
defineProps<{
5+
title?: string
6+
footer?: string
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div class="panel">
12+
<slot name="header">
13+
<MyPanelSection v-if="title" class="panel-header">{{ title }}</MyPanelSection>
14+
</slot>
15+
<slot name="body">
16+
<MyPanelSection class="panel-body">
17+
<slot />
18+
</MyPanelSection>
19+
</slot>
20+
<slot name="footer">
21+
<MyPanelSection v-if="footer" class="panel-footer">{{ footer }}</MyPanelSection>
22+
</slot>
23+
</div>
24+
</template>
25+
26+
<style scoped>
27+
.panel {
28+
border: 1px solid #34495e;
29+
border-radius: 5px;
30+
display: flex;
31+
flex-direction: column;
32+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
33+
overflow: hidden;
34+
}
35+
36+
.panel > * + * {
37+
border-top: 1px solid #34495e;
38+
}
39+
40+
.panel-header, .panel-footer {
41+
background: #34495e;
42+
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
43+
color: #fff;
44+
letter-spacing: 0.5px;
45+
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.25);
46+
}
47+
48+
.panel-section:first-child {
49+
border-top-left-radius: 5px;
50+
border-top-right-radius: 5px;
51+
}
52+
53+
.panel-section:last-child {
54+
border-bottom-left-radius: 5px;
55+
border-bottom-right-radius: 5px;
56+
}
57+
58+
.panel-body {
59+
flex: auto;
60+
overflow: auto;
61+
}
62+
</style>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup lang="ts">
2+
3+
</script>
4+
5+
<template>
6+
<div class="panel-section">
7+
<slot />
8+
</div>
9+
</template>
10+
11+
<style scoped>
12+
.panel-section {
13+
padding: 10px;
14+
}
15+
</style>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export { default as Example } from './components/Example.vue'
2+
export { default as MyPanel } from './components/MyPanel.vue'
3+
export { default as MyPanelSection } from './components/MyPanelSection.vue'
Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
<script setup lang="ts">
2-
import { Example as ExampleComponent } from '@scopedPackageName@'
2+
import { Example as ExampleComponent, MyPanel } from '@scopedPackageName@'
33
</script>
44

55
<template>
6-
<ExampleComponent />
6+
<div class="main">
7+
<ExampleComponent />
8+
<MyPanel title="Panel title" footer="Panel footer">
9+
Header and footer
10+
</MyPanel>
11+
<MyPanel title="Panel title">
12+
Just a header
13+
</MyPanel>
14+
<MyPanel footer="Panel footer">
15+
Just a footer
16+
</MyPanel>
17+
<MyPanel>
18+
No header or footer
19+
</MyPanel>
20+
</div>
721
</template>
22+
23+
<style scoped>
24+
.main > * + * {
25+
margin-top: 10px;
26+
max-width: 300px;
27+
}
28+
</style>
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
<script setup>
2-
import { Example as ExampleComponent } from '@scopedPackageName@'
2+
import { Example as ExampleComponent, MyPanel } from '@skirtle/test-project'
33
</script>
44

5+
<style scoped>
6+
.panel {
7+
margin: 20px 0;
8+
}
9+
</style>
10+
511
# Introduction
612

713
<ExampleComponent />
14+
15+
<MyPanel title="Panel title" footer="Panel footer">
16+
Header and footer
17+
</MyPanel>
18+
19+
<MyPanel title="Panel title">
20+
Just a header
21+
</MyPanel>
22+
23+
<MyPanel footer="Panel footer">
24+
Just a footer
25+
</MyPanel>
26+
27+
<MyPanel>
28+
No header or footer
29+
</MyPanel>

0 commit comments

Comments
 (0)