Skip to content

Commit

Permalink
docs: fix SB diff styles (#5152)
Browse files Browse the repository at this point in the history
* docs: fix SB diff styles

* chore(docs): add missing deps
  • Loading branch information
HeartSquared authored Dec 4, 2024
1 parent 1e9c97a commit c9e1f89
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .changeset/silver-guests-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
15 changes: 15 additions & 0 deletions docs/components/Diff/Diff.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react"
import { Unstyled } from "@storybook/blocks"
import classnames from "classnames"
import Highlight from "react-highlight"

export type DiffProps = {
children: React.ReactNode
className?: string
}

export const Diff = ({ children, className }: DiffProps): JSX.Element => (
<Unstyled>
<Highlight className={classnames("diff", className)}>{children}</Highlight>
</Unstyled>
)
1 change: 1 addition & 0 deletions docs/components/Diff/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Diff"
1 change: 0 additions & 1 deletion docs/components/DocsContainer/DefaultDocsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useContext } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import {
DocsContainer,
DocsContainerProps,
Expand Down
1 change: 0 additions & 1 deletion docs/components/DosAndDonts/DosAndDonts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { HTMLAttributes } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { Canvas, Unstyled } from "@storybook/blocks"
import classnames from "classnames"
import { Text } from "~components/Text"
Expand Down
1 change: 0 additions & 1 deletion docs/components/Installation/Installation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { Source } from "@storybook/blocks"

export type InstallationProps = {
Expand Down
1 change: 0 additions & 1 deletion docs/components/LinkTo/LinkTo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { HTMLAttributes } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { linkTo } from "@storybook/addon-links"
import classnames from "classnames"

Expand Down
1 change: 0 additions & 1 deletion docs/components/NoClipCanvas/NoClipCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useId, useState } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { Source, SourceProps, Story, Unstyled } from "@storybook/blocks"
import classnames from "classnames"
import styles from "./NoClipCanvas.module.scss"
Expand Down
1 change: 0 additions & 1 deletion docs/components/ResourceLinks/ResourceLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { HTMLAttributes } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { Unstyled } from "@storybook/blocks"
import classNames from "classnames"
import { Text } from "~components/Text"
Expand Down
1 change: 0 additions & 1 deletion docs/components/SbContent/SbContent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { HTMLAttributes } from "react"
// eslint-disable-next-line import/no-extraneous-dependencies
import { Unstyled } from "@storybook/blocks"
import classNames from "classnames"
import styles from "./SbContent.module.scss"
Expand Down
3 changes: 1 addition & 2 deletions docs/components/StickerSheet/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { StoryObj } from "@storybook/react"
import type { StoryObj } from "@storybook/react"

export type StickerSheetArgs<T extends Record<string, any>> = {
isReversed?: boolean
Expand Down
5 changes: 3 additions & 2 deletions docs/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export * from "./NoClipCanvas"
export * from "./Diff"
export * from "./DosAndDonts"
export * from "./Installation"
export * from "./LinkTo"
export * from "./NoClipCanvas"
export * from "./ResourceLinks"
export * from "./SbReleaseNotification"
export * from "./SbContent"
export * from "./DosAndDonts"
5 changes: 5 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@
"@kaizen/design-tokens": "workspace:*",
"@kaizen/tailwind": "workspace:*",
"@rollup/plugin-alias": "^5.1.1",
"@storybook/addon-links": "^8.4.6",
"@storybook/blocks": "^8.4.6",
"@storybook/builder-vite": "^8.4.6",
"@storybook/manager-api": "^8.4.6",
"@storybook/react": "^8.4.6",
"@storybook/react-vite": "^8.4.6",
"@storybook/test-runner": "^0.19.1",
"@types/jest-axe": "^3.5.9",
"@types/react-highlight": "^0.12.8",
"@vitejs/plugin-react": "^4.3.3",
"axe-playwright": "^2.0.3",
"classnames": "^2.5.1",
"globals": "^15.12.0",
"highlight.js": "^11.10.0",
"jest-axe": "^9.0.0",
"react-highlight": "^0.15.0",
"sass": "1.79.6",
"storybook": "^8.4.6",
"tailwindcss": "^3.4.15",
Expand Down
7 changes: 4 additions & 3 deletions docs/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ pre code {
font-family: ui-monospace, Menlo, Monaco, "Roboto Mono", "Oxygen Mono",
"Ubuntu Monospace", "Source Code Pro", "Droid Sans Mono", "Courier New",
monospace !important;
font-size: 14px !important;
border: 1px solid rgb(0 0 0 / 10%);
font-size: 13px !important;
line-height: 19px;
border: 1px solid hsla(203, 50%, 30%, 0.15);
box-shadow: rgba(0, 0, 0, 0.1) 0 1px 3px 0;
border-radius: 4px;
padding: 20px !important;
font-weight: 300 !important;
-webkit-font-smoothing: antialiased;
line-height: 19px;
}

#storybook-docs {
Expand Down
12 changes: 5 additions & 7 deletions packages/components/src/KaizenProvider/_docs/KaizenProvider.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta } from "@storybook/blocks"
import Highlight from "react-highlight"
import { Diff } from "~storybook/components"
import migrationBonus from "./code-diffs/migration-bonus.diff?raw"
import migrationFETBonus from "./code-diffs/migration-fe-template-bonus.diff?raw"
import migrationFETToV1 from "./code-diffs/migration-fe-template-to-v1.diff?raw"
Expand Down Expand Up @@ -30,20 +30,18 @@ import { KaizenProvider } from "@kaizen/components";

`KaizenProvider` our new root level wrapping component.


<Highlight className="diff shadow-sm">{migrationToV1}</Highlight>

<Diff>{migrationToV1}</Diff>

If you're using the [frontend-template](https://github.com/cultureamp/frontend-template), you can replace it like this:

Note: `defaultPreset` comes from the `frontend-template`.

<Highlight className="diff shadow-sm">{migrationFETToV1}</Highlight>
<Diff>{migrationFETToV1}</Diff>

### Bonus

If you're using the `defaultTheme`, this is already setup within the provider, so depending on your team's setup you might be able to remove config that sets this up for you.

<Highlight className="diff shadow-sm mb-16">{migrationBonus}</Highlight>
<Diff className="mb-16">{migrationBonus}</Diff>

<Highlight className="diff shadow-sm">{migrationFETBonus}</Highlight>
<Diff>{migrationFETBonus}</Diff>
51 changes: 24 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c9e1f89

Please sign in to comment.