Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix import name and import package #366

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions packages/documentation/.ladle/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ import type { GlobalProvider } from "@ladle/react";
import { IconGitHub } from "@versini/ui-icons";
import clsx from "clsx";

const renderImportLine = (importName: string, stage?: string) => {
const renderImportLine = ({
importName,
importPackage,
stage,
header,
}: {
importName: string;
importPackage?: string;
stage?: string;
header?: string;
}) => {
let variant: "information" | "warning" | "success", releaseTag;
let packageName = importPackage || "ui-components";
let titleHeader = header || importName;

switch (stage) {
case "beta":
Expand All @@ -29,15 +41,15 @@ const renderImportLine = (importName: string, stage?: string) => {
<div className="mb-6">
<Flexgrid alignVertical="center" className="mb-2" columnGap={3}>
<FlexgridItem>
<h1 className="m-0">{importName}</h1>
<h1 className="m-0">{titleHeader}</h1>
</FlexgridItem>
<FlexgridItem>
<Pill label={releaseTag} variant={variant} className="mt-2" />
</FlexgridItem>
</Flexgrid>

<pre className="mt-0">
<code>{`import { ${importName} } from "@versini/ui-components";`}</code>
<code>{`import { ${importName} } from "@versini/${packageName}";`}</code>
</pre>
</div>
);
Expand All @@ -54,7 +66,12 @@ export const Provider: GlobalProvider = ({ children, storyMeta }) => {
<>
<div className={className}>
{storyMeta?.importName
? renderImportLine(storyMeta.importName, storyMeta?.stage)
? renderImportLine({
importName: storyMeta.importName,
importPackage: storyMeta?.importPackage,
header: storyMeta?.header,
stage: storyMeta?.stage,
})
: null}
{children}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ export const ReleaseTags: Story<any> = () => (
help consuming partners, we are applying tags per components: alpha, then
beta and finally stable.
</p>

<p>
Component stage is indicated by a little "pill" located to the right of
the component title.
<strong>NOTE:</strong> component stage is indicated by a little "pill"
located to the right of the component title.
</p>

<Flexgrid alignVertical="center" columnGap={3}>
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/src/System/Flexgrid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
title: "System/Flexgrid",
meta: {
importName: "Flexgrid, FlexgridItem",
importPackage: "ui-system",
},
args: {
className: "",
Expand Down
53 changes: 25 additions & 28 deletions packages/documentation/src/System/Icons.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,34 @@ import {

export default {
title: "System/Icons",
meta: {
header: "Icons",
importName: "IconXYZ",
importPackage: "ui-icons",
},
};

export const Basic: Story<any> = (args) => (
<>
<div className="mb-6 max-w-none">
<h1>Icons</h1>
<pre>
<code>{`import { IconXYZ } from "@versini/ui-icons";`}</code>
</pre>
</div>
<div className="prose prose-dark flex max-w-none flex-wrap gap-2 bg-slate-300 p-10">
<IconBack {...args} />
<IconChart {...args} />
<IconClose {...args} />
<IconCopied {...args} />
<IconCopy {...args} />
<IconDelete {...args} />
<IconEdit {...args} />
<IconGitHub {...args} />
<IconHide {...args} />
<IconHistory {...args} />
<IconInfo {...args} />
<IconNext {...args} />
<IconPrevious {...args} />
<IconProfile {...args} />
<IconRestore {...args} />
<IconSettings {...args} />
<IconShow {...args} />
<IconUser {...args} />
</div>
</>
<div className="prose prose-dark flex max-w-none flex-wrap gap-2 bg-slate-300 p-10">
<IconBack {...args} />
<IconChart {...args} />
<IconClose {...args} />
<IconCopied {...args} />
<IconCopy {...args} />
<IconDelete {...args} />
<IconEdit {...args} />
<IconGitHub {...args} />
<IconHide {...args} />
<IconHistory {...args} />
<IconInfo {...args} />
<IconNext {...args} />
<IconPrevious {...args} />
<IconProfile {...args} />
<IconRestore {...args} />
<IconSettings {...args} />
<IconShow {...args} />
<IconUser {...args} />
</div>
);

Basic.args = {
Expand Down
Loading