diff --git a/playground/components/NuxtBadge.story.vue b/playground/components/NuxtBadge.story.vue
index 03c5217..1187be8 100644
--- a/playground/components/NuxtBadge.story.vue
+++ b/playground/components/NuxtBadge.story.vue
@@ -1,5 +1,8 @@
-
+
Badge
@@ -9,5 +12,21 @@
Badge
+
+
+
+ Badge
+
+
+
+
+
+ Badge
+
+
+
+
+
+
diff --git a/src/runtime/components/Story.vue b/src/runtime/components/Story.vue
index cf6abea..3bfacdc 100644
--- a/src/runtime/components/Story.vue
+++ b/src/runtime/components/Story.vue
@@ -34,6 +34,7 @@
@@ -68,13 +69,20 @@ const tvStory = tv({
},
})
+interface Layout {
+ type?: 'grid' | 'wrap' | 'none'
+ cols?: number
+ width?: string
+}
+
defineOptions({
name: 'StoryContainer',
})
-defineProps<{
+const props = defineProps<{
title?: string
classes?: ComponentSlotClasses
+ layout?: Layout
}>()
const config = useRuntimeConfig()
@@ -91,6 +99,45 @@ const hasVariants = computed(() => {
)
})
+// layout properties
+const layout = computed(() => {
+ // defaults
+ const layout: Layout = {
+ type: 'none',
+ cols: undefined,
+ width: undefined,
+ }
+
+ // columns
+ if (props.layout) {
+ const { cols, width } = props.layout
+
+ // grid
+ if (cols) {
+ layout.type = 'grid'
+ layout.cols = cols
+ }
+
+ else if (width) {
+ // grid
+ if (width.endsWith('%')) {
+ const percent = Number.parseInt(width)
+ layout.type = 'grid'
+ layout.cols = Math.round(1 / (percent / 100))
+ }
+
+ // wrap
+ else if (width.endsWith('px')) {
+ layout.type = 'wrap'
+ layout.width = width
+ }
+ }
+ }
+
+ // return
+ return layout
+})
+
async function openInEditor() {
if (!story) {
return
@@ -105,7 +152,7 @@ async function openInEditor() {
}
-
diff --git a/src/runtime/components/Variant.vue b/src/runtime/components/Variant.vue
index dd34091..f58da45 100644
--- a/src/runtime/components/Variant.vue
+++ b/src/runtime/components/Variant.vue
@@ -146,6 +146,7 @@ watch(() => route.hash, (newHash) => {
.variant-header {
display: var(--variant-header-display);
+ justify-content: var(--variant-header-justify);
gap: var(--variant-header-gap);
align-items: var(--variant-actions-align-content);
}
@@ -155,6 +156,8 @@ watch(() => route.hash, (newHash) => {
font-size: var(--variant-title-font-size);
font-weight: var(--variant-title-font-weight);
letter-spacing: var(--variant-title-letter-spacing);
+ white-space: nowrap;
+ overflow: hidden;
}
}
diff --git a/src/runtime/variables.css b/src/runtime/variables.css
index de78fba..921199e 100644
--- a/src/runtime/variables.css
+++ b/src/runtime/variables.css
@@ -4,6 +4,7 @@
--story-actions-display: flex;
--story-actions-gap: 0.5rem;
--story-border-color: #e5e5e5;
+
--story-container-padding: 0;
--story-container-width: 100%;
--story-content-margin: 1rem 0 0 0;
@@ -11,9 +12,12 @@
--story-content-gap: 1rem;
--story-content-grid-template-columns: ;
--story-content-grid-gap: ;
+
--story-header-align-content: center;
--story-header-display: flex;
--story-header-gap: 0.5rem;
+ --story-header-margin-bottom: 1rem;
+
--story-title-font-size: 1.2rem;
--story-title-font-weight: 500;
--story-title-letter-spacing: -0.02em;
@@ -35,6 +39,7 @@
--variant-content-guideline-border: 0;
--variant-header-align-content: center;
--variant-header-display: flex;
+ --variant-header-justify: space-between;
--variant-header-gap: 0.5rem;
--variant-title-font-size: 1rem;
--variant-title-font-weight: 500;
@@ -51,7 +56,7 @@
/* Stories Layout */
--stories-layout-height: 100vh;
--stories-main-bg-color: #fff;
- --stories-main-padding: 1rem;
+ --stories-main-padding: 1.5rem;
--stories-sidebar-bg-color: #f8f8f8;
--stories-sidebar-border: 1px solid #e5e5e5;
--stories-sidebar-padding: 1rem;