Skip to content

Commit

Permalink
Designsystem chromatic deploy add and a11y testing add (#38)
Browse files Browse the repository at this point in the history
* ๐Ÿ”– Typescript and prettier version up and little change

* โœจ Generate arg types utilfunction add

* โœจ Button ์ปดํฌ๋„ŒํŠธ ์ œ์ž‘ ์™„๋ฃŒ

* โœจ Font ์„ค์ • ์ถ”๊ฐ€

* ๐Ÿšง Font ์ˆœ์„œ๋งž๊ฒŒ ์ •๋ ฌ

* โž• Radix alert dialog dependency add

* ๐Ÿšง Alertdialog ์ž‘์—…

* โœจ ํด๋” ๊ตฌ์กฐ ์ •๋ฆฝ

* โœจ Jsx a11y addon add

* โœจ Chromatic deploy add

* ๐Ÿšง ๋ฃจํŠธ์—์„œ ์‹คํ–‰ํ•˜๋„๋ก ๋ณ€๊ฒฝ

* ๐Ÿšง ๊ถŒ์žฅ์— ๋งž์ถ”์–ด checkoutv1๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ

* ๐Ÿšง Token workspace ๋ฒ„์ „์„ ์“ฐ๋„๋ก ๋ณ€๊ฒฝ

* ๐Ÿšง Eslint rule import/no-unresolved off

* ๐Ÿšง Auto accept change option add

* ๐Ÿšง Chromatic flow wใ…”๊ฑฐ

* ๐Ÿšง Chromatic ci ์„ค์ • ๋ณ€๊ฒฝ

* ๐Ÿšง Chromatic install ์˜ต์…˜ ๋ณ€๊ฒฝ

* ๐Ÿšง Packagejosn qusrud

* ๐Ÿšง Working directory ์ถ”๊ฐ€

* ๐Ÿšง Token reoslve

* ๐Ÿšง Chromatic

* ๐Ÿšง Chromatic ์ˆ˜๋™์œผ๋กœ ๋ณ€๊ฒฝ

* ๐Ÿšง Env์„ค์ • ๋ณ€๊ฒฝ

* ๐Ÿšง Working directory wใ…”๊ฑฐ

* ๐Ÿšง Build ๋ฌธ์ œ์ธ๊ฐ€ ์‹ถ์–ด์„œ ์ถ”๊ฐ€

* ๐Ÿšง Pullrequest ์กฐ๊ฑด ์ถ”๊ฐ€

* ๐Ÿšง ์ „๋ถ€ ๋นŒ๋“œํ•˜๋Š”๊ฑด ๋น„ํšจ์œจ์ ์ด์–ด์„œ token ๋งŒ ๋นŒ๋“œ

* ๐Ÿšง Dependency resolve
  • Loading branch information
XionWCFM committed Apr 10, 2024
1 parent 662cf67 commit b443d9e
Show file tree
Hide file tree
Showing 33 changed files with 1,575 additions and 118 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ module.exports = {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'react/prop-types': 'off',
'import/no-unresolved': 'off',
},
};
36 changes: 36 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Chromatic'

on:
pull_request:
branches:
- main
paths:
- '/packages/design-system'

env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

jobs:
chromatic:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn

- name: Install dependencies
run: yarn install

- name: build all
run: yarn token build

- name: Run Chromatic
run: yarn chromatic
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ coverage
*storybook.log

.env.local
storybook-static

.env
640 changes: 639 additions & 1 deletion .pnp.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion configs/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@xionhub/prettier",
"packageManager": "yarn@4.1.1",
"license": "MIT",
"version": "0.0.3",
"version": "0.0.4",
"main": "./prettierrc.base.json",
"exports": {
"./fsd": "./prettierrc.fsd.json",
Expand Down
1 change: 1 addition & 0 deletions configs/prettier/prettierrc.fsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
'^~widget/(.*)$',
'^~page/(.*)$',
'^~app/(.*)$',
'^~/(.*)$',
'^[./]',
'^[../]',
],
Expand Down
12 changes: 6 additions & 6 deletions configs/prettier/prettierrc.fsd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^[@/]",
"^~shared/(.*)$",
"^~entities/(.*)$",
"^~feature/(.*)$",
"^~widget/(.*)$",
"^~page/(.*)$",
"^~app/(.*)$",

"^[~/]",
"^~features/(.*)$",
"^~widgets/(.*)$",
"^~pages/(.*)$",
"^~apps/(.*)$",
"~/(.*)$",
"^[./]",
"^[../]"
],
Expand Down
Empty file added configs/typescript/README.md
Empty file.
2 changes: 1 addition & 1 deletion configs/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@xionhub/typescript",
"packageManager": "yarn@4.1.1",
"license": "MIT",
"version": "0.0.4",
"version": "0.0.5",
"main": "./tsconfig.base.json",
"exports": {
"./fsd": "./tsconfig.fsd.json",
Expand Down
6 changes: 3 additions & 3 deletions configs/typescript/tsconfig.fsd.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"baseUrl": ".",
"paths": {
"~app/*": ["./src/app/*"],
"~page/*": ["./src/page/*"],
"~widget/*": ["./src/widget/*"],
"~feature/*": ["./src/feature/*"],
"~pages/*": ["./src/pages/*"],
"~widgets/*": ["./src/widgets/*"],
"~features/*": ["./src/features/*"],
"~entities/*": ["./src/entities/*"],
"~shared/*": ["./src/shared/*"],
"~/*": ["./*"]
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
"react": "yarn workspace @xionhub/react-hook",
"util": "yarn workspace @xionhub/util",
"token": "yarn workspace @xionhub/token",
"ds": "yarn workspace @xionhub/xds",
"build": "ultra -r build",
"release": "yarn changeset publish",
"lint": "eslint packages/* --fix",
"storybook": "yarn workspace @xionhub/xds storybook"
"storybook": "yarn workspace @xionhub/xds storybook",
"build-storybook": "yarn workspace @xionhub/xds build-storybook",
"chromatic": "yarn workspace @xionhub/xds chromatic"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
Expand All @@ -31,6 +34,7 @@
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"cross-env": "^7.0.3",
"esbuild": "^0.19.8",
"esbuild-node-externals": "^1.11.0",
"eslint": "latest",
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { StorybookConfig } from '@storybook/react-vite';
import { join, dirname } from 'path';
import { transform } from 'typescript';

/**
* This function is used to resolve the absolute path of a package.
Expand All @@ -21,6 +20,7 @@ const config: StorybookConfig = {
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath('@storybook/addon-a11y'),
],
framework: {
name: getAbsolutePath('@storybook/react-vite'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import type { Preview } from '@storybook/react';
import '../src/tailwind.css';
import '../src/token.css';
import '../src/font.css';
const preview: Preview = {
parameters: {
controls: {
Expand All @@ -10,6 +12,13 @@ const preview: Preview = {
},
},
},
decorators: [
Story => (
<div className=" font-suit">
<Story />
</div>
),
],
};

export default preview;
14 changes: 11 additions & 3 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"build:tsc": "yarn tsc --emitDeclarationOnly",
"build:js": "rollup -c",
"build:css": "tailwindcss -i src/tailwind.css -o dist/xds.css --minify",
"storybook": "storybook dev -p 6006",
"build:storybook": "storybook build",
"build-storybook": "storybook build",
"copy:font": "mkdir dist/font && cp src/font/SUIT-Bold.woff2 dist/font/SUIT-Bold.woff2 && cp src/font/SUIT-Light.woff2 dist/font/SUIT-Light.woff2 && cp src/font/SUIT-Medium.woff2 dist/font/SUIT-Medium.woff2 && && cp src/font/SUIT-Regular.woff2 dist/font/SUIT-Regular.woff2 && cp src/font/SUIT-SemiBold.woff2 dist/font/SUIT-SemiBold.woff2"
"storybook": "storybook dev -p 6006",
"chromatic": "npx chromatic --auto-accept-changes",
"copy:font": "mkdir dist/font && cp src/font/SUIT-Bold.woff2 dist/font/SUIT-Bold.woff2 && cp src/font/SUIT-Light.woff2 dist/font/SUIT-Light.woff2 && cp src/font/SUIT-Medium.woff2 dist/font/SUIT-Medium.woff2 && cp src/font/SUIT-Regular.woff2 dist/font/SUIT-Regular.woff2 && cp src/font/SUIT-SemiBold.woff2 dist/font/SUIT-SemiBold.woff2"
},
"exports": {
".": {
Expand All @@ -26,6 +28,7 @@
"dist"
],
"peerDependencies": {
"@radix-ui/react-alert-dialog": ">=1.0.0",
"@xionhub/token": ">=0.1.9",
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
Expand All @@ -35,6 +38,8 @@
},
"devDependencies": {
"@chromatic-com/storybook": "^1.2.22",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@storybook/addon-a11y": "8.0.4",
"@storybook/addon-essentials": "^8.0.4",
"@storybook/addon-interactions": "^8.0.4",
"@storybook/addon-links": "^8.0.0",
Expand All @@ -47,16 +52,19 @@
"@types/react": "^18.2.39",
"@types/react-dom": "^18",
"@xionhub/rollup": "workspace:^",
"@xionhub/token": "workspace:^",
"@xionhub/token": "0.1.8",
"@xionhub/typescript": "workspace:^",
"autoprefixer": "^10.4.18",
"chromatic": "^11.3.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"postcss": "^8.4.35",
"postcss-import": "^16.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.13.0",
"storybook": "^8.0.4",
"tailwind-merge": "1.14.0",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"typescript": "^5.4.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { forwardRef } from 'react';
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
import { cn } from '../../utils/cn';
const AlertDialogRoot = AlertDialogPrimitive.Root;

const AlertDialogTrigger = AlertDialogPrimitive.Trigger;

const AlertDialogPortal = AlertDialogPrimitive.Portal;

const AlertDialogOverlay = forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
>(({ className, ...props }, ref) => {
return <AlertDialogPrimitive.Overlay ref={ref} className={cn(className)} {...props} />;
});

AlertDialogOverlay.displayName = 'AlertDialogOverlay';

const AlertDialogContent = forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
>(({ className, ...props }, ref) => {
return <AlertDialogContent ref={ref} className={cn(className)} {...props} />;
});

AlertDialogContent.displayName = 'ALertDialogContent';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './alert-dialog';
25 changes: 0 additions & 25 deletions packages/design-system/src/components/button.stories.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions packages/design-system/src/components/button.tsx

This file was deleted.

58 changes: 58 additions & 0 deletions packages/design-system/src/components/button/button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import type { Meta, StoryObj } from '@storybook/react';
import { argTypes } from '../../utils/arg-types';
import { Button } from './button';
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const selectListRounded = ['default', 'xs', 'sm', 'md', 'xl', 'full'] as const;
const selectListSize = ['full', 'half', 'none'] as const;
const selectListPress = ['default', 'press'] as const;
const selectListVariants = [
'primary',
'secondary',
'tetiary',
'ghost',
'danger-primary',
'danger-secondary',
'danger-tetiary',
'danger-ghost',
'neutral-primary',
'neutral-secondary',
'neutral-tetiory',
'neutral-ghost',
'neutral-focus-ghost',
] as const;

const meta = {
title: 'Xds/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: {
variant: argTypes({ control: 'select', options: selectListVariants }),
size: argTypes({ control: 'select', options: selectListSize }),
press: argTypes({ control: 'select', options: selectListPress }),
rounded: argTypes({ control: 'select', options: selectListRounded }),
disabled: argTypes({ control: 'boolean' }),
slot: argTypes({ control: 'text' }),
slotDirection: argTypes({ control: 'select', options: ['start', 'end', 'none'] }),
},
// 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: { variant: 'primary' },
} satisfies Meta<typeof Button>;

export default meta;
type Story = StoryObj<typeof meta>;

export const PrimaryButton: Story = {
args: {
children: 'button',
variant: 'primary',
rounded: 'default',
size: 'full',
press: 'default',
},
};
Loading

0 comments on commit b443d9e

Please sign in to comment.