Skip to content

Commit

Permalink
Merge pull request #42 from Team-B1ND/Feature/#40
Browse files Browse the repository at this point in the history
Feature/#40
  • Loading branch information
s1hyun2 authored Jan 13, 2025
2 parents 490b72b + 6c1f9ed commit 73cc3e6
Show file tree
Hide file tree
Showing 41 changed files with 5,745 additions and 2,565 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##### **📘 할 내용**

- 여기에 작성해 주세요

---
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##### **📘 한 내용**

- 여기에 작성해 주세요

---
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to NPM

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: pnpm install

- name: Build the project
run: pnpm run build

- name: Publish to NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish dist --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 9 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const config = {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
};

module.exports = config;
32 changes: 31 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
{
"name": "dds-web",
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/cjs/index.cjs.js",
"module": "dist/esm/index.esm.js",
"private": true,
"devDependencies": {
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@changesets/cli": "^2.27.1",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@rollup/plugin-url": "^8.0.2",
"@types/typescript": "^2.0.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5"
"prettier": "^3.2.5",
"rollup": "^4.28.1",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-postcss": "^4.0.2",
"typescript": "^5.4.2"
},
"scripts": {
"rollup": "rollup -c",
"build:bundle": "tsc -p tsconfig.base.json && pnpm bundle",
"build": "pnpm build:bundle",
"prepare": "husky",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
Expand All @@ -18,5 +38,15 @@
"hooks": {
"pre-commit": "pnpm lint-staged"
}
},
"dependencies": {
"@dds-web/styles": "workspace:*",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-replace": "^6.0.2",
"@svgr/rollup": "^8.1.0",
"@types/react": "^19.0.2",
"@types/styled-components": "^5.1.34",
"react": "^18.2.0",
"styled-components": "^6.1.8"
}
}
1 change: 1 addition & 0 deletions packages/assets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src";
2 changes: 1 addition & 1 deletion packages/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@dds-web/styles": "workspace: *",
"@types/react": "^18.2.73",
"@types/react": "18.2.0",
"@types/styled-components": "^5.1.34"
}
}
2 changes: 1 addition & 1 deletion packages/assets/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./fonts";
export * from "./icons";
export * from "./icons";
3 changes: 2 additions & 1 deletion packages/assets/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"jsx": "react"
},
"extends": "../../tsconfig.base.json",
"include": ["./src"]
Expand Down
1 change: 1 addition & 0 deletions packages/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src";
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@storybook/blocks": "^8.0.2",
"@storybook/react": "^8.4.1",
"@storybook/react-webpack5": "^8.4.1",
"@types/react": "^18.2.67",
"@types/react-dom": "^18.2.22",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"storybook": "^8.4.1",
"swc-loader": "^0.2.6"
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ui";
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const DodamSegmentedButton = ({
{segmentedBtndata.map((item, idx) => (
<StyledSegmentedButton
key={idx}
ref={(e) => (buttonRefs.current[idx] = e)}
ref={(e: HTMLButtonElement | null) => (buttonRefs.current[idx] = e)}
num={num}
type={type}
isAtv={item.isAtv}
Expand Down
17 changes: 0 additions & 17 deletions packages/components/src/ui/DatePicker/DatePicker.test.tsx

This file was deleted.

14 changes: 7 additions & 7 deletions packages/components/src/ui/DatePicker/DodamDatePicker.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { DodamDatePicker, DatePickerProps } from "./DodamDatePicker";
import { DodamDatePicker, DatePickerProps } from "./DodamDatePicker";

const meta: Meta<typeof DodamDatePicker> = {
title: "ui/DodamDatePicker",
Expand All @@ -16,12 +16,12 @@ type Story = StoryObj<typeof meta>;

export const StyledDatePicker: Story = {
args: {
itemKey: "unique-key",
width: "100%",
height: "40px",
value: "2024-11-12",
onChange: (date: Date) => alert(date),
itemKey: "unique-key",
width: "100%",
height: "40px",
value: "2024-11-12",
onChange: (date: Date) => alert(date),
title: "외출 일시",
color: "black"
color: "black",
} as DatePickerProps,
};
26 changes: 26 additions & 0 deletions packages/components/src/ui/PageIndicator/PageIndicator.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from "@storybook/react";
import { PageIndicator } from "./PageIndicator";
import React from "react";

const meta = {
title: "ui/DodamPageIndicator",
component: PageIndicator,
tags: ["autodocs"],
} satisfies Meta<typeof PageIndicator>;

export default meta;

type Story = StoryObj<typeof meta>;


export const PageIndicatorWithCases: Story = {
args: {
buttonSize: "Large",
caseBy: {
Page1: <div>첫 번째</div>,
Page2: <div>두 번째</div>,
Page3: <div>세 번째</div>,
},
defaultComponent: <div>기본 컴포넌트</div>,
},
};
37 changes: 37 additions & 0 deletions packages/components/src/ui/PageIndicator/PageIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { useState } from "react";
import * as S from "./style";
import { PageIndicatorProps } from "./type";

export const PageIndicator = ({
caseBy,
buttonSize = "Large",
defaultComponent = null,
}: PageIndicatorProps) => {
const [activeIdx, setActiveIdx] = useState<number>(0);

const handleButtonClick = (idx: number) => {
setActiveIdx(idx);
};

if (!caseBy || Object.keys(caseBy).length === 0) {
return defaultComponent;
}

const keys = Object.keys(caseBy);

return (
<div>
<S.PageIndicatorWrap buttonSize={buttonSize}>
{keys.map((_, idx) => (
<S.IndicatorBtn
key={idx}
idx={idx}
activeIdx={activeIdx}
buttonSize={buttonSize}
onClick={() => handleButtonClick(idx)}></S.IndicatorBtn>
))}
</S.PageIndicatorWrap>
<div>{caseBy[keys[activeIdx]]}</div>
</div>
);
};
1 change: 1 addition & 0 deletions packages/components/src/ui/PageIndicator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./PageIndicator";
33 changes: 33 additions & 0 deletions packages/components/src/ui/PageIndicator/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import styled, { css } from "styled-components";
import { ButtonSize } from "./type";
import { DodamLightTheme } from "@dds-web/styles/src/DodamTheme/DodamTheme";

export const PageIndicatorWrap = styled.div<{ buttonSize: ButtonSize }>`
width: auto;
height: auto;
gap: ${({ buttonSize }) => (buttonSize === "Small" ? "5px" : "10px")};
display: flex;
`;

export const IndicatorBtn = styled.div<{
idx: number;
activeIdx: number;
buttonSize: ButtonSize;
}>`
${({ buttonSize }) =>
buttonSize === "Small"
? css`
width: 5px;
height: 5px;
`
: css`
width: 10px;
height: 10px;
`}
border-radius: 50%;
background-color: ${({ idx, activeIdx }) =>
idx === activeIdx
? DodamLightTheme.primaryNormal
: DodamLightTheme.labelDisabled};
cursor: pointer;
`;
7 changes: 7 additions & 0 deletions packages/components/src/ui/PageIndicator/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type ButtonSize = "Small" | "Large"

export interface PageIndicatorProps {
buttonSize: ButtonSize;
caseBy :Partial<Record<string, JSX.Element | null>>
defaultComponent?: JSX.Element | null;
}
1 change: 1 addition & 0 deletions packages/components/src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from "./ErrorBoundary";
export * from "./NotFoundPage";
export * from "./TextField";
export * from "./Typography";
export * from "./PageIndicator";
3 changes: 2 additions & 1 deletion packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src",
"types": ["react","styled-components"],
"types": ["react", "react-dom", "styled-components"],
"jsx": "react"
},
"extends": "../../tsconfig.base.json",
"include": ["./src"]
Expand Down
1 change: 1 addition & 0 deletions packages/foundations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src";
4 changes: 2 additions & 2 deletions packages/foundations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"typescript": "^5.4.2"
},
"devDependencies": {
"@dds-web/styles": "workspace:*",
"@dds-web/assets": "workspace:*",
"@types/react": "^18.2.67",
"@dds-web/styles": "workspace:*",
"@types/react": "^18.2.0",
"@types/styled-components": "^5.1.34"
}
}
3 changes: 2 additions & 1 deletion packages/foundations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"jsx": "react"
},
"extends": "../../tsconfig.base.json",
"include": ["./src"]
Expand Down
1 change: 1 addition & 0 deletions packages/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src";
2 changes: 1 addition & 1 deletion packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"typescript": "^5.4.2"
},
"devDependencies": {
"@types/react": "^18.2.67"
"@types/react": "^18.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/hooks/src/useDatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const useDatePicker = ({
const [lastDate, setLastDate] = useState<number>(dayList.indexOf(1));

//데이트 피커 ref
const containerRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement | null>(null);
const [calendarCoord, setCalendarCoold] = useState({ x: 0, y: 0 });

//데이트피커 아웃사이드 클릭 체크
Expand Down
3 changes: 2 additions & 1 deletion packages/hooks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"jsx": "react"
},
"extends": "../../tsconfig.base.json",
"include": ["./src"]
Expand Down
6 changes: 6 additions & 0 deletions packages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from "./assets";
export * from "./components";
export * from "./foundations";
export * from "./hooks";
export * from "./styles";
export * from "./utils";
1 change: 1 addition & 0 deletions packages/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src";
Loading

0 comments on commit 73cc3e6

Please sign in to comment.