Skip to content

Commit

Permalink
📝 - docs: further improvements to Kanban(Template) stories
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Oct 18, 2024
1 parent ae1780b commit 7fc5c69
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/components/data/kanban/kanban.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const AdditionalFields: Story = {
},
};

export const WithCustomPreview: Story = {
export const CustomPreview: Story = {
...KanbanComponent,
// @ts-expect-error - Fix never
args: {
Expand All @@ -76,6 +76,7 @@ export const WithCustomPreview: Story = {
alt={attributeData.title}
src="/static/maykin_logo.png"
height="24"
style={{ objectFit: "contain" }}
/>
),
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/data/kanban/kanban.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export const KanbanSection: React.FC<KanbanSectionProps> = ({
>
{fieldset[0] && (
<Toolbar directionResponsive={false} pad={false} variant="transparent">
<H3>{fieldset[0]}</H3>
<H3>{field2Title(fieldset[0])}</H3>
<Badge rounded>{objectList.length}</Badge>
</Toolbar>
)}
Expand Down
12 changes: 9 additions & 3 deletions src/lib/format/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ export const addSpaces = (string: string) =>

/**
* Converts "fieldName" to "Field name".
* @param field
* @deprecated Use `field2title` instead.
*/
export const field2Caption = (field: string): string =>
ucFirst(unHyphen(addSpaces(field)));
export const field2Caption = (field: string): string => {
if (process && process?.env?.NODE_ENV !== "production") {
console.warn(
"DEPRECATION: `field2Caption` is deprecated, use `field2Title` instead.",
);
}
return ucFirst(unHyphen(addSpaces(field)));
};

interface Field2TitleOptions {
addSpaces?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/templates/kanban/kanban.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as React from "react";

import { Badge, Outline } from "../../components";
import {
CustomPreview as CustomPreviewComponentStory,
Draggable as DraggableComponentStory,
KanbanComponent as KanbanComponentStory,
WithCustomPreview as WithCustomPreviewComponentStory,
WithToolbar as WithToolbarComponentStory,
} from "../../components/data/kanban/kanban.stories";
import { KanbanTemplate } from "./kanban";
Expand Down Expand Up @@ -120,11 +120,11 @@ export const WithSecondaryNavigation: Story = {
},
};

export const WithCustomPreview: Story = {
export const CustomPreview: Story = {
...kanbanTemplate,
args: {
...kanbanTemplate.args,
kanbanProps: WithCustomPreviewComponentStory.args,
kanbanProps: CustomPreviewComponentStory.args,
},
};

Expand Down

0 comments on commit 7fc5c69

Please sign in to comment.