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

Dev #72

Merged
merged 7 commits into from
May 20, 2024
Merged

Dev #72

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
11 changes: 11 additions & 0 deletions .changeset/khaki-parrots-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'eslint-config-custom': major
'tailwind-config': major
'tsconfig': major
'utils': major
'ui': major
'cms': major
'web': major
---

Primitive storybooks and code gen tools
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
- name: Install
run: pnpm install --no-frozen-lockfile

- name: Lint
run: pnpm test:run
- name: Test
run: pnpm test:run --passWithNoTests
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ packages
└─ utility functions
```

## Contributing

All commit messages must adhere the gitmoji commitlint conventions

```base
:sparkles: feat(changelog): support chinese title

:bug: fix(config): fix a subject bug

:memo: docs: update README.md

:bulb: docs(plugin): update comments
```

[More emoji here](https://gitmoji.dev/)

### Sanity

Includes live preview, singletons, nested documents [via Sanity page tree](https://github.com/Q42/sanity-plugin-page-tree)
4 changes: 1 addition & 3 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
}
module.exports = { extends: ['gitmoji'] }
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@commitlint/config-conventional": "^19.2.2",
"@manypkg/cli": "^0.21.4",
"commitlint": "^19.3.0",
"commitlint-config-gitmoji": "^2.3.1",
"husky": "^9.0.11",
"hygen": "^6.2.11",
"lint-staged": "^15.2.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@chromatic-com/storybook": "^1.3.3",
"@storybook/addon-essentials": "^8.1.1",
"@storybook/addon-interactions": "^8.1.1",
"@storybook/addon-links": "^8.1.1",
"@storybook/addon-onboarding": "^8.1.1",
"@storybook/addon-webpack5-compiler-swc": "^1.0.2",
"@storybook/blocks": "^8.1.1",
"@storybook/nextjs": "^8.1.1",
"@storybook/react": "^8.1.1",
Expand Down
11 changes: 0 additions & 11 deletions packages/ui/src/componenets/Footer/Footer.spec.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions packages/ui/src/componenets/Footer/Footer.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/ui/src/componenets/Footer/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/ui/src/hooks/usePrevious/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './usePrevious'
9 changes: 9 additions & 0 deletions packages/ui/src/hooks/usePrevious/usePrevious.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react'

export function usePrevious<T>(value: T): T | undefined {
const ref = React.useRef<T>()
React.useEffect(() => {
ref.current = value
}, [value])
return ref.current
}
39 changes: 39 additions & 0 deletions packages/ui/src/primitives/Accordion/Accordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import * as Accordion from '.'

const meta = {
title: 'primitives/Accordion',
component: Accordion.Root,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof Accordion.Root>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {
type: 'single',
},
render: () => (
<Accordion.Root type="single">
<Accordion.Item value="a">
<Accordion.Trigger>Item</Accordion.Trigger>
<Accordion.Content>Hello</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="b">
<Accordion.Trigger>Item</Accordion.Trigger>
<Accordion.Content>Hello</Accordion.Content>
</Accordion.Item>
</Accordion.Root>
),
}
29 changes: 29 additions & 0 deletions packages/ui/src/primitives/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import * as Alert from '.'

const meta = {
title: 'primitives/Alert',
component: Alert.Root,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {},
args: {},
} satisfies Meta<typeof Alert.Root>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {},
render: () => (
<Alert.Root>
<Alert.Title>Hello</Alert.Title>
<Alert.Description>
<p>Ah chucks</p>
</Alert.Description>
</Alert.Root>
),
}
36 changes: 36 additions & 0 deletions packages/ui/src/primitives/AlertDialog/AlertDialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import * as AlertDialog from '.'

const meta = {
title: 'primitives/AlertDialog',
component: AlertDialog.Root,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof AlertDialog.Root>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {},
render: () => (
<AlertDialog.Root>
<AlertDialog.Trigger>Item</AlertDialog.Trigger>
<AlertDialog.Content>
<AlertDialog.Title>Item</AlertDialog.Title>
<AlertDialog.Description>Hello</AlertDialog.Description>
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
<AlertDialog.Action>Action</AlertDialog.Action>
</AlertDialog.Content>
</AlertDialog.Root>
),
}
28 changes: 28 additions & 0 deletions packages/ui/src/primitives/Badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Badge } from '.'
import type { Meta, StoryObj } from '@storybook/react'

const meta = {
title: 'primitives/Badge',
component: Badge,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof Badge>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {
children: 'Hello world',
variant: 'default',
// type: 'Badge',
},
}
13 changes: 11 additions & 2 deletions packages/ui/src/primitives/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ import React from 'react'
import { Button } from '.'

const meta = {
component: Button,
title: 'primitives/Button',
component: Button,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof Button>

export default meta
type Story = StoryObj<typeof meta>

Expand Down
52 changes: 52 additions & 0 deletions packages/ui/src/primitives/Carousel/Carousel.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import * as Carousel from '.'

const meta = {
title: 'primitives/Carousel',
component: Carousel.Root,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof Carousel.Root>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {
options: {},
},
render: () => (
<Carousel.Root
options={{
active: true,
axis: 'x',
align: 'center',
slidesToScroll: 1,
}}
>
<Carousel.Prev>Prev</Carousel.Prev>
<Carousel.Next>Next</Carousel.Next>
<Carousel.Viewport>
<Carousel.Item className="w-full flex-shrink-0">A</Carousel.Item>
<Carousel.Item className="w-full flex-shrink-0">B</Carousel.Item>
<Carousel.Item className="w-full flex-shrink-0">C</Carousel.Item>
<Carousel.Item className="w-full flex-shrink-0">D</Carousel.Item>
</Carousel.Viewport>
<Carousel.Dots>
<Carousel.Dot index={0}>Dot</Carousel.Dot>
<Carousel.Dot index={1}>Dot</Carousel.Dot>
<Carousel.Dot index={2}>Dot</Carousel.Dot>
<Carousel.Dot index={3}>Dot</Carousel.Dot>
</Carousel.Dots>
</Carousel.Root>
),
}
2 changes: 1 addition & 1 deletion packages/ui/src/primitives/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const usePrevNextButtons = (
export type TCarouselProps = {
options?: EmblaOptionsType
plugins?: EmblaPluginType
children: React.ReactNode
children?: React.ReactNode
}

export function Root({ options, plugins, children }: TCarouselProps) {
Expand Down
31 changes: 31 additions & 0 deletions packages/ui/src/primitives/Collapsible/Collapsible.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import * as Collapsible from '.'

const meta = {
title: 'primitives/Collapsible',
component: Collapsible.Root,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: {},
} satisfies Meta<typeof Collapsible.Root>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
args: {},
render: () => (
<Collapsible.Root>
<Collapsible.Trigger>Item</Collapsible.Trigger>
<Collapsible.Content>Hello</Collapsible.Content>
</Collapsible.Root>
),
}
Loading
Loading