Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
namti committed Feb 3, 2024
1 parent 631b8e5 commit c73fb1b
Show file tree
Hide file tree
Showing 165 changed files with 24,244 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
210 changes: 210 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
// disable compile check
const DEV_ERROR = 'error';
const REACT_ERROR = 2;

const overrideRules = {
'react-hooks/rules-of-hooks': DEV_ERROR,
'react-hooks/exhaustive-deps': 'off',
'react/jsx-curly-newline': [ REACT_ERROR ],
'react/jsx-curly-spacing': [ REACT_ERROR, { when: 'always', children: true } ],
'react/jsx-equals-spacing': [ REACT_ERROR, 'never' ],
'react/jsx-tag-spacing': [ REACT_ERROR, { beforeSelfClosing: 'always' } ],
'no-extra-semi': [ DEV_ERROR ],
'no-mixed-spaces-and-tabs': [ DEV_ERROR, 'smart-tabs' ],
'no-unreachable': [ DEV_ERROR ],
'no-unused-vars': [ DEV_ERROR ],
'array-bracket-spacing': [ DEV_ERROR, 'always' ],
'array-element-newline': [
DEV_ERROR,
{
multiline: true,
minItems: 3,
},
],
'block-spacing': [ DEV_ERROR, 'always' ],
'object-curly-spacing': [ DEV_ERROR, 'always' ],
'quotes': [
DEV_ERROR,
'single',
{ allowTemplateLiterals: true },
],
'quote-props': [ DEV_ERROR, 'consistent-as-needed' ],
'comma-spacing': [
DEV_ERROR,
{
before: false,
after: true,
},
],
'comma-style': [ DEV_ERROR ],
'array-bracket-newline': [ DEV_ERROR, { multiline: true } ],
'object-curly-newline': [ DEV_ERROR, { multiline: true } ],
'indent': [
'warn',
2,
{ SwitchCase: 1 },
],
'sort-imports': [ DEV_ERROR, { ignoreDeclarationSort: true, allowSeparatedGroups: true } ],
'semi': [ DEV_ERROR, 'always' ],
'semi-spacing': [ DEV_ERROR ],
'semi-style': [ DEV_ERROR, 'last' ],
'comma-dangle': [
DEV_ERROR,
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
},
],
'newline-per-chained-call': [ DEV_ERROR, { ignoreChainWithDepth: 1 } ],
'no-extra-boolean-cast': [ 'error' ],
'no-empty': [ 'error' ],
'implicit-arrow-linebreak': [ DEV_ERROR, 'beside' ],
// 'jsonc/sort-keys': [ DEV_ERROR ],
'jsonc/indent': [
DEV_ERROR,
2,
{},
],
'jsonc/array-bracket-spacing': [ DEV_ERROR, 'always' ],
'jsonc/array-bracket-newline': [
DEV_ERROR,
{
multiline: true,
minItems: 2,
},
],
'jsonc/array-element-newline': [
DEV_ERROR,
{
multiline: true,
minItems: 2,
},
],
'jsonc/object-curly-newline': [ DEV_ERROR, { minProperties: 2 } ],
'jsonc/object-curly-spacing': [ DEV_ERROR, 'always' ],
'jsonc/key-spacing': [
DEV_ERROR,
{
beforeColon: false,
afterColon: true,
mode: 'strict',
},
],
'jsx-quotes': [ DEV_ERROR, 'prefer-double' ],
'key-spacing': [
DEV_ERROR,
{
beforeColon: false,
afterColon: true,
mode: 'strict',
},
],
'arrow-spacing': [ DEV_ERROR ],
'prefer-arrow-callback': [ DEV_ERROR ],
'arrow-body-style': [ DEV_ERROR, 'as-needed' ],
'arrow-parens': [ DEV_ERROR, 'as-needed' ],
'no-confusing-arrow': [ DEV_ERROR ],
'no-multi-spaces': [ DEV_ERROR ],
'no-trailing-spaces': [ DEV_ERROR ],
'space-in-parens': [ DEV_ERROR, 'never' ],
'space-before-function-paren': [
DEV_ERROR,
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],
};

const config = {
parser: '@typescript-eslint/parser',
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:jsonc/recommended-with-jsonc',
'plugin:storybook/recommended',
],
env: { es6: true, browser: true },
rules: {
'constructor-super': [ 'error' ],
'for-direction': [ 'error' ],
'getter-return': [ 'error' ],
'no-case-declarations': [ 'error' ],
'no-class-assign': [ 'error' ],
'no-compare-neg-zero': [ 'error' ],
'no-cond-assign': [ 'error' ],
'no-const-assign': [ 'error' ],
'no-constant-condition': [ 'error' ],
'no-control-regex': [ 'error' ],
'no-debugger': [ 'error' ],
'no-delete-var': [ 'error' ],
'no-dupe-args': [ 'error' ],
'no-dupe-class-members': [ 'error' ],
'no-dupe-else-if': [ 'error' ],
'no-dupe-keys': [ 'error' ],
'no-duplicate-case': [ 'error' ],
'no-empty-character-class': [ 'error' ],
'no-empty-pattern': [ 'error' ],
'no-ex-assign': [ 'error' ],
'no-fallthrough': [ 'error' ],
'no-func-assign': [ 'error' ],
'no-global-assign': [ 'error' ],
'no-import-assign': [ 'error' ],
'no-inner-declarations': [ 'error' ],
'no-invalid-regexp': [ 'error' ],
'no-irregular-whitespace': [ 'error' ],
'no-loss-of-precision': [ 'error' ],
'no-misleading-character-class': [ 'error' ],
'no-new-symbol': [ 'error' ],
'no-nonoctal-decimal-escape': [ 'error' ],
'no-obj-calls': [ 'error' ],
'no-octal': [ 'error' ],
'no-redeclare': [ 'error' ],
'no-regex-spaces': [ 'error' ],
'no-self-assign': [ 'error' ],
'no-setter-return': [ 'error' ],
'no-shadow-restricted-names': [ 'error' ],
'no-sparse-arrays': [ 'error' ],
'no-this-before-super': [ 'error' ],
'no-undef': [ 'error' ],
'no-unexpected-multiline': [ 'error' ],
'no-unsafe-finally': [ 'error' ],
'no-unsafe-negation': [ 'error' ],
'no-unsafe-optional-chaining': [ 'error' ],
'no-unused-labels': [ 'error' ],
'no-useless-backreference': [ 'error' ],
'no-useless-catch': [ 'error' ],
'no-useless-escape': [ 'warn' ],
'no-with': [ 'error' ],
'require-yield': [ 'error' ],
'use-isnan': [ 'error' ],
'valid-typeof': [ 'error' ],
...overrideRules,
},
overrides: [
{
files: [ '**/*.ts?(x)' ],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
},
},
],
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
},
ignorePatterns: [ '*.json' ],

};

module.exports = config;
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
19 changes: 19 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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;
36 changes: 36 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"editor.insertSpaces": false,
"editor.formatOnType": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"json",
"jsonc",
"json5"
],
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"scss.format.newlineBetweenSelectors": false,
"scss.format.spaceAroundSelectorSeparator": true,
"css.format.newlineBetweenSelectors": false,
"css.format.spaceAroundSelectorSeparator": true,
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }
}
15 changes: 15 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = function (api) {
api.cache(true);

const presets = [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
];
const plugins = [];

return {
presets,
plugins
};
}
Binary file added dist/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions dist/cjs/index.js

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

1 change: 1 addition & 0 deletions dist/cjs/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/cjs/types/components/Book/Book.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React, { PropsWithChildren } from 'react';
import { BookProps } from './Book.types';
declare const Book: React.FC<PropsWithChildren<BookProps>>;
export default Book;
21 changes: 21 additions & 0 deletions dist/cjs/types/components/Book/Book.types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
export interface BookProps {
cover?: string;
title?: string;
subtitle?: string;
leftCornerRadius?: string;
rightCornerRadius?: string;
creaseMargin?: string;
creaseWidth?: string;
thickness?: string;
coverColor?: string;
coverMargin?: string;
transitionTimingFunction?: TransitionTimingFunction;
transitionDuration: TransitionDuration;
coverCloseAngle?: number;
coverOpenAngle?: number;
coverContent?: React.JSX.Element | React.JSX.Element[];
pageContent?: React.JSX.Element | React.JSX.Element[];
}
export type TransitionDuration = `${number}ms` | `${number}s`;
export type TransitionTimingFunction = 'ease' | 'ease-in' | 'ease-in-out' | 'ease-out' | 'jump-both' | 'jump-end' | 'jump-none' | 'jump-start' | 'linear' | 'step-end' | 'step-start' | 'steps' | `cubic-bezier(${string})` | `linear(${string})`;
5 changes: 5 additions & 0 deletions dist/cjs/types/components/Book/Styled.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="react" />
export declare const BookWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
export declare const FrontCover: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
export declare const BackCover: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
export declare const Pages: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
4 changes: 4 additions & 0 deletions dist/cjs/types/components/Button.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';
import { ButtonProps } from './Button.types';
declare const Button: React.FC<ButtonProps>;
export default Button;
8 changes: 8 additions & 0 deletions dist/cjs/types/components/Button.types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { MouseEventHandler } from 'react';
export interface ButtonProps {
text?: string;
primary?: boolean;
disabled?: boolean;
size: 'small' | 'medium' | 'large';
onClick: MouseEventHandler<HTMLButtonElement>;
}
4 changes: 4 additions & 0 deletions dist/cjs/types/components/Input.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FC } from 'react';
import { InputProps } from './Input.types';
declare const Input: FC<InputProps>;
export default Input;
11 changes: 11 additions & 0 deletions dist/cjs/types/components/Input.types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ChangeEventHandler } from "react";
export interface InputProps {
id?: string;
label?: string;
error?: boolean;
message?: string;
success?: boolean;
disabled?: boolean;
placeholder?: string;
onChange?: ChangeEventHandler<HTMLInputElement>;
}
2 changes: 2 additions & 0 deletions dist/cjs/types/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Button';
export * from './Input';
1 change: 1 addition & 0 deletions dist/cjs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components';
1 change: 1 addition & 0 deletions dist/cjs/types/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const interpolateNumber: (value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number) => number;
Binary file added dist/esm/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions dist/esm/index.js

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

1 change: 1 addition & 0 deletions dist/esm/index.js.map

Large diffs are not rendered by default.

Binary file added dist/esm/types/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions dist/esm/types/components/Book/Book.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React, { PropsWithChildren } from 'react';
import { BookProps } from './Book.types';
declare const Book: React.FC<PropsWithChildren<BookProps>>;
export default Book;
Loading

0 comments on commit c73fb1b

Please sign in to comment.