diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7ef84674d..7122fe5dd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,7 +1,6 @@ # Contributing All contributions are appreciated, and anyone is welcome to contribute to the library. -
## Issues @@ -14,7 +13,7 @@ In addition to raising issues, you can fork `@modern-kit` and raise pull request Please see the caveats below 🙏 - if you are adding a new feature, please open an issue to discuss it in advance. -- The node version should be `v18.17.1`. You can easily version match with `nvm install`, `nvm use`. +- The node version should be `v20+`. You can easily version match with `nvm install`, `nvm use`. ```shell nvm install ``` @@ -30,13 +29,6 @@ yarn test yarn typecheck ``` -
- -If you would like to contribute to the official documentation, please create a `.md` file in the `docs/prepareDocs` folder for `en` and `ko`. - -![스크린샷 2023-08-20 오전 1 30 55](https://github.com/Team-Grace/devgrace/assets/64779472/b5e772c9-89e1-4e31-8647-ffb1dfc26588) - -
## Conventional Commits @@ -44,7 +36,7 @@ If you would like to contribute to the official documentation, please create a ` ``` (): -ex: feat(ui): Add Select Component +ex: feat(react): Add Select Component ``` ### Type @@ -57,7 +49,6 @@ Type must be one of those ### Package Scope The name of package that you made changes. -- ui - react - utils diff --git a/README.md b/README.md index 3bb6ceb5e..153cc2b5e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@
-`@modern-kit`는 유용한 `리액트 UI 컴포넌트`, `리액트 커스텀 훅` 및 다양한 `유틸리티 함수`를 제공하는 라이브러리 입니다. +`@modern-kit`는 클라이언트 개발에 유용한 `리액트 커스텀 훅` 및 `유틸리티 함수`를 제공하는 라이브러리 입니다.
diff --git a/lerna.json b/lerna.json index 9892bf277..2084a5169 100644 --- a/lerna.json +++ b/lerna.json @@ -9,7 +9,6 @@ "**/*.stories.*", "**/__storybook__/*", "**/*.md", - "./packages/ui", "./docs" ] } diff --git a/packages/react/src/components/AB/AB.spec.tsx b/packages/react/src/components/AB/AB.spec.tsx deleted file mode 100644 index 1cf9dcc00..000000000 --- a/packages/react/src/components/AB/AB.spec.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import { AB } from '.'; -import { renderSetup } from '../../utils/test/renderSetup'; - -const { CaseA, CaseB } = AB; - -const NormalTestComponent = () => { - return ( - - -
A
-
- -
B
-
-
- ); -}; - -const FailTestComponent1 = () => { - return ( - - -
A
-
- -
A
-
-
- ); -}; - -const FailTestComponent2 = () => { - return ( - - -
A
-
-
Other
-
- ); -}; - -const FailTestComponent3 = () => { - return ( - - -
A
-
-
- ); -}; - -describe('AB Component', () => { - it('should render CaseA or CaseB in the normal case', () => { - const { container } = renderSetup(); - expect(container.childElementCount).toBe(1); - }); - - it('should not render anything if rendering a duplicate component type', () => { - const { container } = renderSetup(); - expect(container.childElementCount).toBe(0); - }); - - it('should not render anything if rendering an invalid component type', () => { - const { container } = renderSetup(); - expect(container.childElementCount).toBe(0); - }); - - it('should not render anything if the children length is 1', () => { - const { container } = renderSetup(); - expect(container.childElementCount).toBe(0); - }); -}); diff --git a/packages/react/src/components/AB/index.tsx b/packages/react/src/components/AB/index.tsx deleted file mode 100644 index f0d3e965d..000000000 --- a/packages/react/src/components/AB/index.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React, { PropsWithChildren, useEffect } from 'react'; -import { abRandom, noop } from '@modern-kit/utils'; -import { usePreservedCallback } from '../../hooks/usePreservedCallback'; - -interface ABProps { - renderAction?: () => void; -} - -const OVER_COUNT = 2; - -export const AB = ({ children }: PropsWithChildren) => { - const ab = abRandom(); - const childrenList = React.Children.toArray(children) as JSX.Element[]; - let aCount = 0; - let bCount = 0; - - if (childrenList.length !== 2) { - return null; - } - - for (const child of childrenList) { - const isValidComponentType = [AB.CaseA, AB.CaseB].includes(child.type); - - if (!isValidComponentType) { - return null; - } - - if (child.type === AB.CaseA) { - aCount += 1; - } else { - bCount += 1; - } - } - - if (aCount >= OVER_COUNT || bCount >= OVER_COUNT) { - return null; - } - return ab ? childrenList[0] : childrenList[1]; -}; - -AB.CaseA = ({ children, renderAction }: PropsWithChildren) => { - const callbackRenderAction = usePreservedCallback(renderAction || noop); - - useEffect(() => { - callbackRenderAction(); - }, [callbackRenderAction]); - - return {children}; -}; - -AB.CaseB = ({ children, renderAction }: PropsWithChildren) => { - const callbackRenderAction = usePreservedCallback(renderAction || noop); - - useEffect(() => { - callbackRenderAction(); - }, [callbackRenderAction]); - - return {children}; -}; diff --git a/packages/react/src/components/index.ts b/packages/react/src/components/index.ts index ffcd753bd..634d93af2 100644 --- a/packages/react/src/components/index.ts +++ b/packages/react/src/components/index.ts @@ -1,4 +1,3 @@ -export * from './AB'; export * from './DebounceWrapper'; export * from './InView'; export * from './LazyImage';