Skip to content

Commit

Permalink
Merge pull request #10 from MJU-Letter/1st-QA-fix
Browse files Browse the repository at this point in the history
Feat:#9 modal nextUi library
  • Loading branch information
frombozztoang authored Feb 19, 2024
2 parents 8dc417a + ce7bd0d commit bb6b5fc
Show file tree
Hide file tree
Showing 33 changed files with 3,605 additions and 995 deletions.
3,962 changes: 3,237 additions & 725 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@nextui-org/react": "^2.2.9",
"framer-motion": "^11.0.5",
"next": "14.1.0",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 1 addition & 1 deletion src/app/(main)/test/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MainDetail from "@/components/templates/main/MainDetail";
import React from "react";
import MainDetail from "../../../components/templates/main/MainDetail";

const page = () => {
return (
Expand Down
11 changes: 11 additions & 0 deletions src/app/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NextUIProvider } from "@nextui-org/react";
import type { AppProps } from "next/app";
import React from "react";

export default function MyApp({ Component, pageProps }: AppProps) {
return (
<NextUIProvider>
<Component {...pageProps} />
</NextUIProvider>
);
}
6 changes: 3 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className="flex justify-center tablet:w-screen ">
<html lang="en" className=" bg-main-background">
<body className="flex justify-center">
<figure className=" hidden tablet:flex tablet:h-screen tablet:items-center tablet:pr-[216px] transition-opacity duration-500 ease-in-out opacity-0 tablet:opacity-100 ">
<Image
className="w-419 h-198 object-contain "
Expand All @@ -27,7 +27,7 @@ export default function RootLayout({
/>
</figure>
<main className="flex flex-col items-center tablet:flex-none w-fit ">
<header className="w-full">
<header className="w-full mb-76">
<Navigation />
</header>
{children}
Expand Down
1 change: 1 addition & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Main from "@/components/templates/main/Main";
import Image from "next/image";
import React from "react";

export default function Home() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/setting/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import ProfileSetting from "@/components/organisms/profileSetting/ProfileSetting";
import React from "react";
import testProfile from "../../../../public/icons/testProfile.png";
import testProfile '../../../'

const page = () => {
const test = () => {
Expand Down
15 changes: 5 additions & 10 deletions src/components/atoms/letter/Letter.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import Image, { StaticImageData } from "next/image";
import { COLORS } from "@/constants/letterColors";
import { letterProps } from "@/types/Letter";
import Image from "next/image";
import React from "react";
import trash from "../../../../public/icons/trash.png";

interface LetterProps {
letterText: string;
user?: { name: string; profileImg: StaticImageData | string };
backgroundColor: string;
isMine: boolean;
}

const Letter = ({ letterText, user, backgroundColor, isMine }: LetterProps) => {
const Letter = ({ letterText, user, backgroundColor, isMine }: letterProps) => {
const trimmedText =
letterText.length > 140
? `${letterText.slice(0, 140)}... 더보기`
Expand All @@ -18,7 +13,7 @@ const Letter = ({ letterText, user, backgroundColor, isMine }: LetterProps) => {
<div
className={`w-148 pt-8 pb-12 px-12 gangwon-medium`}
style={{
backgroundColor: `${backgroundColor}`,
backgroundColor: COLORS[backgroundColor],
boxShadow: "0px 0px 4px 0px rgba(0, 0, 0, 0.15)",
}}
>
Expand Down
35 changes: 0 additions & 35 deletions src/components/molecules/modal/ModalContent.stories.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions src/components/molecules/modal/ModalContent.tsx

This file was deleted.

98 changes: 84 additions & 14 deletions src/components/molecules/modal/ModalView.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,93 @@
import { modalProps } from "@/types/Modal";
import {
Button,
Modal,
ModalBody,
ModalContent,
ModalFooter,
} from "@nextui-org/react";
import React, { HTMLAttributes } from "react";

interface Props extends HTMLAttributes<HTMLDivElement> {
interface modalViewProps extends HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
}

const ModalView = ({ children, ...props }: Props) => {
// 모달 클릭 시 백드롭에도 터치 이벤트가 전파되는 것을 막기 위함
const handleClickModalView = (
e: React.MouseEvent<HTMLDivElement, MouseEvent>
) => {
e.stopPropagation();
isOpen: boolean;
onOpen: () => void;
onOpenChange: (isOpen: boolean) => void;
noBtn?: {
info: string;
handler?: () => void;
};
yesBtn?: {
info: string;
handler?: () => void;
};
}

const ModalView = ({
children,
isOpen,
onOpen,
onOpenChange,
noBtn,
yesBtn,
...props
}: modalViewProps) => {
return (
<div className="fixed bg-[#00000030] top-0 left-0 w-full h-full flex justify-center items-center z-modal">
<div onClick={handleClickModalView} {...props}>
{children}
</div>
</div>
<Modal
classNames={{
base: "w-fit min-h-fit overflow-x-hidden ",
}}
isDismissable={false}
shouldBlockScroll={true}
placement="center"
isOpen={isOpen}
onOpenChange={onOpenChange}
>
<ModalContent>
{(onClose) => (
<div className="medium-medium w-280 min-h-fit pt-60 pb-16 px-16 rounded-16 bg-white flex flex-col items-center justify-center box-border z-modal">
<ModalBody>{children}</ModalBody>
<ModalFooter>
{noBtn && yesBtn && (
<div className="flex items-center justify-between">
<Button
className="mr-8 w-120 h-44 bg-gray-light flex items-center justify-center text-gray-medium-text-2"
onClick={() => {
noBtn.handler && noBtn.handler();
onClose();
}}
>
{noBtn.info}
</Button>
<Button
className="w-120 h-44 bg-main-point text-white flex items-center justify-center"
onClick={() => {
yesBtn.handler && yesBtn.handler();
onClose();
}}
>
{yesBtn.info}
</Button>
</div>
)}
{!noBtn && yesBtn && (
<div>
<Button
className="mt-[-12px] w-248 h-44 bg-main-point text-white flex items-center justify-center"
onClick={() => {
yesBtn.handler && yesBtn.handler();
onClose();
}}
>
{yesBtn.info}
</Button>
</div>
)}
</ModalFooter>
</div>
)}
</ModalContent>
</Modal>
);
};

Expand Down
45 changes: 0 additions & 45 deletions src/components/organisms/modal/AuthModal.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/organisms/modal/LetterModal.stories.tsx

This file was deleted.

51 changes: 0 additions & 51 deletions src/components/organisms/modal/LetterModal.tsx

This file was deleted.

Loading

0 comments on commit bb6b5fc

Please sign in to comment.