diff --git a/.github/workflows/git-push.yml b/.github/workflows/git-push.yml new file mode 100644 index 0000000..68a48e7 --- /dev/null +++ b/.github/workflows/git-push.yml @@ -0,0 +1,30 @@ +name: git push into another repo to deploy to vercel + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + container: pandoc/latex + steps: + - uses: actions/checkout@v2 + - name: Install mustache (to update the date) + run: apk add ruby && gem install mustache + - name: creates output + run: sh ./build.sh + - name: Pushes to another repository + id: push_directory + uses: cpina/github-action-push-to-another-repository@main + env: + API_TOKEN_GITHUB: ${{ secrets.VECEL_TOKEN }} + with: + source-directory: 'output' + destination-github-username: jungjunhyung99 + destination-repository-name: Wedvice_FE + user-email: ${{ secrets.GITHUB_EMAIL }} + commit-message: ${{ github.event.commits[0].message }} + target-branch: main + - name: Test get variable exported by push-to-another-repository + run: echo $DESTINATION_CLONED_DIRECTORY diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..2b5f119 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh +cd ../ +mkdir output +cp -R ./Wedvice_FE/* ./output +cp -R ./output ./Wedvice_FE/ \ No newline at end of file diff --git a/src/components/molecules/listTab/ListTab.stories.tsx b/src/components/molecules/listTab/ListTab.stories.tsx new file mode 100644 index 0000000..ba8b6c5 --- /dev/null +++ b/src/components/molecules/listTab/ListTab.stories.tsx @@ -0,0 +1,61 @@ +'use client'; + +import type { Meta, StoryObj } from '@storybook/react'; +import { useState } from 'react'; +import { ListTab, ListTabProps } from './ListTab'; +import { TabInfo } from '../tab/Tab'; + +// ListTab 타입 정의 +type ListTabType = 'all' | 'inProgress' | 'completed'; + +const defaultListTabInfo: TabInfo = [ + { tabType: 'all', label: '전체', count: 7 }, + { tabType: 'inProgress', label: '진행 중', count: 5 }, + { tabType: 'completed', label: '진행 완료' }, +]; + +const meta: Meta = { + title: 'components/ListTab', + component: ListTab, + argTypes: { + selectedTab: { control: 'text' }, + onClick: { action: 'clicked' }, + }, +}; +export default meta; + +type Story = StoryObj>; + +// 기본 ListTab UI +export const Default: Story = { + render: (args) => { + const [selectedTab, setSelectedTab] = useState('all'); + + return ( + + ); + }, + args: { + tabInfo: defaultListTabInfo, + }, +}; + +// count가 있는 ListTab +export const WithCounts: Story = { + render: (args) => { + const [selectedTab, setSelectedTab] = useState('all'); + + return ( + + ); + }, +}; diff --git a/src/components/molecules/listTab/ListTab.tsx b/src/components/molecules/listTab/ListTab.tsx new file mode 100644 index 0000000..014f100 --- /dev/null +++ b/src/components/molecules/listTab/ListTab.tsx @@ -0,0 +1,51 @@ +'use client'; + +import { Dispatch, forwardRef, SetStateAction } from 'react'; +import { TabInfo } from '../tab/Tab'; + +export interface ListTabProps { + tabInfo: TabInfo; + selectedTab: T; + className?: string; + onClick: Dispatch>; +} + +const ListTabComponent = ( + { className, tabInfo, selectedTab, onClick, ...props }: ListTabProps, + ref: React.Ref, +) => { + return ( +
+ {tabInfo.map(({ tabType, label, count }) => { + const isSelected = selectedTab === tabType; + + return ( + + ); + })} +
+ ); +}; + +export const ListTab = forwardRef(ListTabComponent) as ( + props: ListTabProps & { ref?: React.Ref }, +) => JSX.Element; diff --git a/src/components/molecules/listTab/index.ts b/src/components/molecules/listTab/index.ts new file mode 100644 index 0000000..f5f70f9 --- /dev/null +++ b/src/components/molecules/listTab/index.ts @@ -0,0 +1 @@ +export { ListTab } from './ListTab';