Skip to content

Commit

Permalink
feat: improve vertical separator rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlsndr committed Aug 29, 2023
1 parent c6825fa commit a2bf08f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
37 changes: 37 additions & 0 deletions src/components/Separator/index.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Meta, StoryObj } from '@storybook/vue3';
import Separator from './index.vue';
import { ref } from 'vue';

const meta: Meta<typeof Separator> = {
title: 'Ui/Separator',
component: Separator,
argTypes: {
vert: { control: { type: 'boolean' } },
colorClass: { control: { type: 'text' } },
},
args: {
vert: false,
},
};

export default meta;

type Story = StoryObj<typeof Separator>;


export const Default: Story = {
render: (args) => ({
components: { Separator },
setup: () => {

return {
args,
};
},
template: `
<Separator class="w-64 h-64" v-bind="args">
Hi there test
</Separator>
`,
}),
};
8 changes: 4 additions & 4 deletions src/components/Separator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
class="flex-shrink-0"
:class="[colorClass, vert ? 'w-px self-stretch' : 'h-px w-full']"
></div>
<div v-else class="flex items-center">
<div v-else class="flex items-center gap-2" :class="[vert ? 'flex-col' : 'flex-row ']">
<div
class="flex-1"
:class="[colorClass, vert ? 'w-px self-stretch' : 'h-px w-full']"
:class="[colorClass, vert ? 'w-px' : 'h-px']"
></div>
<div class="flex-shrink-0 px-2">
<div class="flex-shrink-0">
<slot />
</div>
<div
class="flex-1"
:class="[colorClass, vert ? 'w-px self-stretch' : 'h-px w-full']"
:class="[colorClass, vert ? 'w-px' : 'h-px']"
></div>
</div>
</template>
Expand Down

0 comments on commit a2bf08f

Please sign in to comment.