Skip to content

Commit

Permalink
Merge pull request #75 from softeerbootcamp4th/feat/CLAP-138
Browse files Browse the repository at this point in the history
chore(CLAP-138): 공통로직 core로 이동
  • Loading branch information
DaeWon9 authored Aug 13, 2024
2 parents b868eeb + f01d630 commit 21433c6
Show file tree
Hide file tree
Showing 92 changed files with 112 additions and 156 deletions.
13 changes: 13 additions & 0 deletions packages/core/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
interface ImportMetaEnv {
readonly VITE_FB_API_KEY: string;
readonly VITE_FB_AUTH_DOMAIN: string;
readonly VITE_FB_PROJECT_ID: string;
readonly VITE_FB_STORAGE_BUCKET: string;
readonly VITE_FB_MESSAGING_SENDER_ID: string;
readonly VITE_FB_APP_ID: string;
readonly VITE_FB_MEASUREMENT_ID: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
"@emotion/react": "^11.11.4"
"@emotion/react": "^11.11.4",
"firebase": "^10.12.4"
},
"devDependencies": {
"@types/react": "^18.3.3",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
56 changes: 0 additions & 56 deletions packages/core/src/assets/tmp.svg

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createContext, Dispatch, SetStateAction } from "react";
import { ModalType } from "../components/ModalContainer/ModalContainer";

export interface ModalState {
type: ModalType | null;
props?: any; // todo change any
type: any;
props?: any;
}

export const ModalStateContext = createContext<ModalState | null>(null);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ModalContext";
3 changes: 3 additions & 0 deletions packages/core/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { useAuth } from "./useAuth";
export { useModal } from "./useModal";
export { useScrollStop } from "./useScrollStop";
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
export * from "./models";
export * from "./theme";
5 changes: 0 additions & 5 deletions packages/core/src/models/TestModel.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/src/models/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { ReactNode, useState } from "react";
import {
ModalSetterContext,
ModalStateContext,
ModalState,
} from "../contexts/ModalContext";

import { ModalSetterContext, ModalStateContext, ModalState } from "../contexts";
interface ModalProviderProps {
children: ReactNode;
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/providers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ModalProvider";
2 changes: 2 additions & 0 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./orderEvent";
export * from "./partsEvent";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { customFetch } from "./customFetch";
export { getAccessToken } from "./getAccessToken";
5 changes: 2 additions & 3 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.root.json",
"compilerOptions": {
"jsx": "react-jsx",
"paths": {
"@core/*": [
"src/*"
Expand Down Expand Up @@ -31,7 +32,5 @@
"noFallthroughCasesInSwitch": true,
},
"files": [],
"include": [
"src",
]
"include": ["src", "./vite-env.d.ts"],
}
1 change: 1 addition & 0 deletions packages/core/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
2 changes: 1 addition & 1 deletion packages/service/src/Demo/pages/ButtonDemoPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, ButtonVariant } from "@service/common/components/Button";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";
import { css } from "@emotion/react";
import { ClipBoardButton } from "@service/common/components/ClipBoardButton";
import { CheckBox } from "@service/common/components/CheckBox";
Expand Down
2 changes: 1 addition & 1 deletion packages/service/src/Demo/pages/ModalDemoPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useModal } from "@service/common/hooks/useModal";
import { useModal } from "@watermelon-clap/core/src/hooks";
import { Button } from "@service/common/components/Button";

export const ModalDemoPage = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/service/src/apis/orderEvent/apiGetOrderEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IOrderEvent } from "./type";
import { customFetch } from "@service/common/utils/customFetch";
import { IOrderEvent } from "@watermelon-clap/core/src/types";
import { customFetch } from "@watermelon-clap/core/src/utils";

export const apiGetOrderEvent = async (id?: string): Promise<IOrderEvent[]> => {
const url = id
Expand Down
7 changes: 5 additions & 2 deletions packages/service/src/apis/orderEvent/apiPostOrderEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { IPostOrderEventRequest, IPostOrderEventResponse } from "./type";
import { customFetch } from "@service/common/utils/customFetch";
import {
IPostOrderEventRequest,
IPostOrderEventResponse,
} from "@watermelon-clap/core/src/types";
import { customFetch } from "@watermelon-clap/core/src/utils";

const DEFAULT_DELAY = 2000;

Expand Down
2 changes: 1 addition & 1 deletion packages/service/src/apis/partsEvent/apiGetPartsRemain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAccessToken } from "@service/common/utils";
import { getAccessToken } from "@watermelon-clap/core/src/utils";

export const apiGetPartsRemain = () =>
fetch(`${import.meta.env.VITE_BACK_BASE_URL}/event/parts/remain`, {
Expand Down
4 changes: 2 additions & 2 deletions packages/service/src/apis/partsEvent/apiPostParts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAccessToken } from "@service/common/utils";
import { IParts } from "./type";
import { IParts } from "@watermelon-clap/core/src/types";
import { getAccessToken } from "@watermelon-clap/core/src/utils";

export const apiPostParts = (): Promise<IParts> =>
fetch(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@emotion/react";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const longButtonStyle = css`
${theme.flex.center}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@emotion/react";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const checkBoxContainerStyle = css`
${theme.flex.center}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@emotion/react";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const clipButtonStyle = css`
${theme.flex.center}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const footerStyles = css`
position: relative;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { GNB_BREAKPOINT } from "@service/constants/breakpoints";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const headerContainerStyles = css`
padding: 16px calc(-30px + 10%);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { GNB_BREAKPOINT } from "@service/constants/breakpoints";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const navsContainerStyles = (isOpen: boolean) => css`
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@emotion/react";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";
import { motion, Transition } from "framer-motion";

interface IMenuButtonProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext } from "react";
import { createPortal } from "react-dom";
import { ModalStateContext } from "@service/common/contexts/ModalContext";
import { useModal } from "@service/common/hooks/useModal";
import { ModalStateContext } from "@watermelon-clap/core/src/contexts";
import { useModal } from "@watermelon-clap/core/src/hooks";
import {
GoogleLoginModal,
PendingModal,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { Space } from "@service/common/styles/Space";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";
import { ReactComponent as NLogo } from "public/images/gnb/n-logo.svg";

export const MODAL_N_QUIZ_TITLE = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const alertModalStyles = {
content: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Modal from "react-modal";
import { Button, ButtonVariant } from "../../../Button";
import { useScrollStop } from "@service/common/hooks/useScrollStop";
import { useScrollStop } from "@watermelon-clap/core/src/hooks";
import { alertModalStyles, alertModalBodyStyles } from "./AlertModal.css";
import { ReactNode } from "react";
import { DefaultModalProps } from "../../ModalContainer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const googleLoginModalStyles = {
content: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Modal from "react-modal";
import { Button, ButtonVariant } from "../../../Button";
import { useScrollStop } from "@service/common/hooks/useScrollStop";
import { useAuth } from "@service/common/hooks/useAuth";
import { useScrollStop, useAuth } from "@watermelon-clap/core/src/hooks";
import { theme } from "@watermelon-clap/core/src/theme";
import {
googleLoginModalStyles,
googleLoginModalBodyStyles,
} from "./GoogleLoginModal.css";
import { theme } from "@watermelon-clap/core";
import { DefaultModalProps } from "../../ModalContainer";

export const GoogleLoginModal = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const navigatgeModalStyles = {
content: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Modal from "react-modal";
import { Button, ButtonVariant } from "../../../Button";
import { useScrollStop } from "@service/common/hooks/useScrollStop";
import { useScrollStop } from "@watermelon-clap/core/src/hooks";
import { theme } from "@watermelon-clap/core/src/theme";
import {
navigatgeModalStyles,
navigatgeModalBodyStyles,
navigateButtonStyle,
} from "./NavigateModal.css";
import { ReactNode } from "react";
import { DefaultModalProps } from "../../ModalContainer";
import { theme } from "@watermelon-clap/core";
import { NEW_CAR_PAGE_ROUTE } from "@service/constants/routes";

export interface NavigateModalProps extends DefaultModalProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const pendingModalStyles = {
content: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Modal from "react-modal";
import { useScrollStop } from "@service/common/hooks/useScrollStop";
import { useScrollStop } from "@watermelon-clap/core/src/hooks";
import { theme } from "@watermelon-clap/core/src/theme";
import {
pendingModalStyles,
pendingModalBodyStyles,
pendingImgStyle,
} from "./PendingModal.css";
import { DefaultModalProps } from "../../ModalContainer";
import { theme } from "@watermelon-clap/core";
import { css } from "@emotion/react";
import { MODAL_N_QUIZ_TITLE } from "../../content/modalContent";

Expand Down
1 change: 0 additions & 1 deletion packages/service/src/common/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./getAccessToken";
export * from "./confettiCrafter";
export * from "./formatter";
2 changes: 1 addition & 1 deletion packages/service/src/components/main/Banner/Banner.css.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const container = css`
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion packages/service/src/components/main/Banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect, useRef, useCallback } from "react";
import { Button, ButtonVariant } from "src/common/components/Button";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";
import { css } from "@emotion/react";
import * as style from "./Banner.css";
import { mobile } from "@service/common/responsive/responsive";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const eventCard = (isMainEvent: boolean) => css`
padding: 72px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";
import * as style from "./EventCard.css";
import { IEventData } from "@service/pages/Main/eventData";
import { Button, ButtonVariant } from "@service/common/components/Button";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from "@emotion/react";
import { mobile } from "@service/common/responsive/responsive";
import { theme } from "@watermelon-clap/core";
import { theme } from "@watermelon-clap/core/src/theme";

export const container = css`
color: ${theme.color.white};
Expand Down
Loading

0 comments on commit 21433c6

Please sign in to comment.