Skip to content

Commit

Permalink
fix(breadcrumbs): fix story configuration of BreadcrumbItem (#1246)
Browse files Browse the repository at this point in the history
* fix: href on link

* fix(breadcrumbs): fix story configuration of BreadcrumbItem

* fix whitespace

* correct url -> href

* Revert "fix: href on link"

This reverts commit 5db2f406db0ffb7160151c320f8b096607ce4390.

* fix markdown lint

---------

Co-authored-by: Sanjeev Suresh <ssuresh@dialpad.com>
  • Loading branch information
braddialpad and sanjeevdialpad authored Oct 5, 2023
1 parent d90d890 commit 3ce325d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 23 deletions.
44 changes: 44 additions & 0 deletions components/breadcrumbs/breadcrumb_item.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { createTemplateFromVueFile } from '@/common/storybook_utils';
import DtBreadcrumbItem from './breadcrumb_item.vue';

import DtBreadcrumbItemDefaultTemplate from './breadcrumb_item_default.story.vue';

// Default Prop Values
export const argsData = {
href: '#',
label: 'Breadcrumb Item',
selected: false,
};

export const argTypesData = {
};

// Story Collection
export default {
title: 'Components/Breadcrumbs',
component: DtBreadcrumbItem,
args: argsData,
argTypes: argTypesData,
excludeStories: /.*Data$/,
};

// Templates
const DefaultTemplate = (args, { argTypes }) =>
createTemplateFromVueFile(args, argTypes, DtBreadcrumbItemDefaultTemplate);

export const BreadcrumbItem = {
render: DefaultTemplate,
args: {},
parameters: {
a11y: {
config: {
rules: [
{
id: 'listitem',
enabled: false,
},
],
},
},
},
};
17 changes: 17 additions & 0 deletions components/breadcrumbs/breadcrumb_item_default.story.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<dt-breadcrumb-item
:inverted="inverted"
:selected="selected"
:label="label"
:href="href"
/>
</template>

<script>
import DtBreadcrumbItem from './breadcrumb_item.vue';
export default {
name: 'DtBreadcrumbItemDefault',
components: { DtBreadcrumbItem },
};
</script>
4 changes: 3 additions & 1 deletion components/breadcrumbs/breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Canvas, Story, Subtitle, Controls, Meta } from '@storybook/blocks';

import * as BreadcrumbsStories from './breadcrumbs.stories';

import * as BreadcrumbItemStories from './breadcrumb_item.stories';

<Meta of={BreadcrumbsStories}/>

# Breadcrumbs
Expand Down Expand Up @@ -54,7 +56,7 @@ These breadcrumbs styles are provided in two visual styles:

Breadcrumb items include [Link component](?path=/story/components-link--default).

<Controls of={BreadcrumbsStories.BreadcrumbItem} />
<Controls of={BreadcrumbItemStories.BreadcrumbItem} />

## Accessibility

Expand Down
23 changes: 1 addition & 22 deletions components/breadcrumbs/breadcrumbs.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createTemplateFromVueFile } from '@/common/storybook_utils';
import DtBreadcrumbs from './breadcrumbs.vue';
import DtBreadcrumbItem from './breadcrumb_item.vue';

import DtBreadcrumbsDefaultTemplate from './breadcrumbs_default.story.vue';
import DtBreadcrumbsVariantsTemplate from './breadcrumbs_variants.story.vue';
Expand Down Expand Up @@ -48,7 +47,7 @@ export const argTypesData = {
control: 'object',
table: {
defaultValue: {
summary: '{ url: string, label: string }[]',
summary: '{ href: string, label: string }[]',
},
},
},
Expand All @@ -69,9 +68,6 @@ const DefaultTemplate = (args, { argTypes }) =>
const VariantsTemplate = (args, { argTypes }) =>
createTemplateFromVueFile(args, argTypes, DtBreadcrumbsVariantsTemplate);

const BreadcrumbItemTemplate = (args, { argTypes }) =>
createTemplateFromVueFile(args, argTypes, DtBreadcrumbItem);

export const Default = {
render: DefaultTemplate,
args: {},
Expand All @@ -97,20 +93,3 @@ export const Variants = {
},
},
};

export const BreadcrumbItem = {
render: BreadcrumbItemTemplate,
args: {},
parameters: {
a11y: {
config: {
rules: [
{
id: 'listitem',
enabled: false,
},
],
},
},
},
};

0 comments on commit 3ce325d

Please sign in to comment.