Skip to content

Commit

Permalink
merge: pull request #1 from zuramai in project-structure branch
Browse files Browse the repository at this point in the history
feat: use monorepo and pnpm workspace
  • Loading branch information
syauqi authored Nov 7, 2023
2 parents 21ecae5 + 3ac4b88 commit 51aada9
Show file tree
Hide file tree
Showing 30 changed files with 15,135 additions and 14,355 deletions.
19 changes: 0 additions & 19 deletions .storybook/main.js

This file was deleted.

27 changes: 27 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx',"../packages/**/*.stories.tsx"],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
{
name: "@storybook/addon-postcss",
options: {
postcssLoaderOptions: {
implementation: require("postcss"),
},
},
},
],
typescript: {
check: false
},
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;
7 changes: 0 additions & 7 deletions .storybook/preview.js

This file was deleted.

16 changes: 16 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "tailwindcss/tailwind.css";
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
58 changes: 34 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@
"node": ">=10"
},
"scripts": {
"start": "set NODE_OPTIONS=--openssl-legacy-provider && tsdx watch",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && tsdx build",
"test": "tsdx test --passWithNoTests",
"lint": "tsdx lint",
"prepare": "tsdx build",
"build": "pnpm run -r --filter packages/* build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint ./**/*.ts --fix",
"size": "size-limit",
"analyze": "size-limit --why",
"storybook": "set NODE_OPTIONS=--openssl-legacy-provider && start-storybook -p 6006",
"build-storybook": "set NODE_OPTIONS=--openssl-legacy-provider && build-storybook",
"chromatic": "npx chromatic --project-token=chpt_f2040c498eb8da3"
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"release": "bumpp package.json packages/*/package.json --tag --commit --push && pnpm -r publish --access public"
},
"peerDependencies": {
"react": ">=16"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
"pre-commit": "npm run lint"
}
},
"prettier": {
Expand All @@ -52,35 +51,46 @@
}
],
"devDependencies": {
"@babel/core": "^7.21.3",
"@size-limit/preset-small-lib": "^8.2.4",
"@storybook/addon-essentials": "^6.5.16",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-links": "^6.5.16",
"@storybook/addon-essentials": "^7.6.0-alpha.4",
"@storybook/addon-interactions": "^7.6.0-alpha.4",
"@storybook/addon-links": "^7.6.0-alpha.4",
"@storybook/addon-mdx-gfm": "^7.6.0-alpha.4",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/addons": "^6.5.16",
"@storybook/react": "^6.5.16",
"@types/react-dom": "^18.0.11",
"@storybook/blocks": "^7.6.0-alpha.4",
"@storybook/react": "^7.6.0-alpha.4",
"@storybook/react-vite": "^7.6.0-alpha.4",
"@storybook/test": "^7.6.0-alpha.4",
"@storybook/testing-library": "^0.2.2",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"chromatic": "^7.6.0",
"eslint": "^8.45.0",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.3",
"postcss": "^8.4.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.11.0",
"react-is": "^18.2.0",
"rollup-plugin-postcss": "^4.0.2",
"size-limit": "^8.2.4",
"storybook": "^7.0.26",
"tailwindcss": "^3.3.0",
"tsdx": "^0.14.1",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
"typescript": "^5.2.2",
"vite": "^4.4.1"
},
"dependencies": {
"@headlessui/react": "^1.7.17",
"@tailwindcss/forms": "^0.5.6"
},
"readme": "ERROR: No README data found!",
"_id": "[email protected]"
"_id": "[email protected]",
"eslintConfig": {
"extends": [
"plugin:storybook/recommended"
]
}
}
17 changes: 17 additions & 0 deletions packages/avatar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@bootwind/button",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.14"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Meta } from '@storybook/react/types-6-0';
import Avatar, { AvatarProps } from '../src/components/Avatar';
import { Meta } from '@storybook/react';
import Avatar, { AvatarProps } from '../src/index';

export default {
title: 'Components/Avatar',
Expand Down Expand Up @@ -28,14 +28,14 @@ export const Avatars = (args: AvatarProps) => (
<div className="flex space-x-4">
<Avatar
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
alt="User 1"
{...args}
alt="User 1"
/>
<Avatar
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
alt="User 2"
{...args}
alt="User 2"
/>
<Avatar showPlaceholder={true} alt="User 2" {...args} />
<Avatar showPlaceholder={true} {...args} alt="User 2" />
</div>
);
4 changes: 4 additions & 0 deletions packages/avatar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
}
17 changes: 17 additions & 0 deletions packages/button/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@bootwind/button",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.14"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactElement } from 'react';
import { ReactNode } from 'react';

type ButtonVariant = 'primary' | 'secondary' | 'ghost';
Expand All @@ -10,16 +10,17 @@ export interface ButtonProps
size?: ButtonSize;
hasArrow?: boolean;
icon?: ReactNode;
children?: ReactNode
}

export const Button: React.FC<ButtonProps> = ({
export const Button = ({
variant = 'primary',
size = 'md',
hasArrow = false,
icon,
children,
...props
}) => {
}: ButtonProps) => {
const baseStyles =
'inline-flex items-center rounded-lg border border-transparent font-semibold';

Expand All @@ -41,10 +42,12 @@ export const Button: React.FC<ButtonProps> = ({
const buttonStyles = `${baseStyles} ${sizeStyles[size]} ${colorStyles[variant]}`;

return (
<>
<button type="button" className={buttonStyles} {...props}>
{icon && <span className="mr-2">{icon}</span>}
{children}
{hasArrow && <span className="ml-2"></span>}
</button>
</>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Meta } from '@storybook/react/types-6-0';
import { Button, ButtonProps } from '../src/components/Button';
import { Meta } from '@storybook/react';
import { Button, ButtonProps } from '../src/index';

import { FaRegEnvelope } from 'react-icons/fa6'; // Import ikon dari react-icons atau dari sumber lain

Expand Down Expand Up @@ -53,4 +53,4 @@ export const Sizes = (args: ButtonProps) => (
<Button size="lg">Large</Button>
</div>
</div>
);
);
4 changes: 4 additions & 0 deletions packages/button/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
}
17 changes: 17 additions & 0 deletions packages/checkbox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@bootwind/button",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.14"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Meta } from '@storybook/react/types-6-0';
import Checkbox, { CheckboxProps } from '../src/components/Checkbox';
import { Meta } from '@storybook/react';
import Checkbox, { CheckboxProps } from '../src/index';

export default {
title: 'Components/Checkbox',
Expand Down
4 changes: 4 additions & 0 deletions packages/checkbox/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
}
17 changes: 17 additions & 0 deletions packages/toggle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@bootwind/button",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.14"
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState } from 'react';
import { Switch } from '@headlessui/react';

function classNames(...classes) {
function classNames(...classes: string[]) {
return classes.filter(Boolean).join(' ');
}

export interface ToggleProps {
onToggle: (isEnabled: boolean) => void;
color: 'primary' | 'secondary';
iconOn: React.ReactNode;
iconOff: React.ReactNode;
onToggle?: (isEnabled: boolean) => void
color: 'primary' | 'secondary'
iconOn?: React.ReactNode
iconOff?: React.ReactNode
}

const Toggle: React.FC<ToggleProps> = ({ color, iconOn, iconOff }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Meta } from '@storybook/react/types-6-0';
import Toggle, { ToggleProps } from '../src/components/Toggle';
import { Meta } from '@storybook/react';
import Toggle, { ToggleProps } from '../src/index';

import { FaMoon, FaSun } from 'react-icons/fa6';

Expand Down Expand Up @@ -39,4 +39,4 @@ export const ToggleDark = (args: ToggleProps) => (
color="secondary"
/>
</div>
);
);
4 changes: 4 additions & 0 deletions packages/toggle/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
}
Loading

0 comments on commit 51aada9

Please sign in to comment.