Skip to content

Commit

Permalink
Merge pull request #29 from JongMany/feat/refactor-architecture
Browse files Browse the repository at this point in the history
[Feat] 모바일 대응...
  • Loading branch information
JongMany authored Jul 29, 2024
2 parents 8801a11 + d2716f2 commit a0c08db
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
env: {
es2020: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
ignorePatterns: ["dist", ".eslintrc.cjs"],
rules: {
// 공통 규칙을 여기에 추가하세요
},
};
1 change: 1 addition & 0 deletions fe/src/entities/career/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./ui/MyCareer";
File renamed without changes.
1 change: 0 additions & 1 deletion fe/src/entities/profile/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions fe/src/entities/projects/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default } from "./ui/project/Project";
export { default as ProjectContainer } from "./ui/project/ProjectContainer";
export { default as FileDownloadButton } from "./ui/download-button/FileDownloadButton";
1 change: 1 addition & 0 deletions fe/src/entities/projects/ui/project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function Project({
>
<div
className={`flex ${
// isAlignReverse ? "flex-row-reverse" : "flex-row"
isAlignReverse ? "flex-row-reverse" : "flex-row"
} gap-x-4 w-[85vw]`}
>
Expand Down
130 changes: 130 additions & 0 deletions fe/src/entities/projects/ui/project/ProjectContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { useDeviceSize } from "@/shared/libs";
import { PropsWithChildren, useRef } from "react";
import { motion, useInView } from "framer-motion";
import { Link } from "react-router-dom";
type Props = {
isAlignReverse?: boolean;
};
export default function ProjectContainer({
isAlignReverse,
children,
}: PropsWithChildren<Props>) {
const device = useDeviceSize();

const rowAlign = device === "desktop" ? "row" : "col";
const alignStyle = getAlignStyle(rowAlign, isAlignReverse);

const containerRef = useRef<HTMLElement>(null);
const isInView = useInView(containerRef, {});

return (
<motion.article
className="flex h-[70vh] items-center justify-center"
ref={containerRef}
style={{
transform: isInView ? "none" : "translateX(-200px)",
opacity: isInView ? 1 : 0,
transition: "all 0.5s cubic-bezier(0.17, 0.55, 0.55, 1) 1s",
// transitionDelay: "0.5s",
}}
>
<div className={`flex ${alignStyle} gap-x-4 w-[85vw]`}>{children}</div>
</motion.article>
);
}

function getAlignStyle(alignDirection: "row" | "col", alignReverse?: boolean) {
if (alignDirection === "col") {
return "flex-col";
}

if (alignReverse) {
return "flex-row-reverse";
}
return "flex-row";
}

const ImageContainer = ({
image,
alt = "project",
}: {
image: string;
alt?: string;
}) => {
const device = useDeviceSize();
const imageStyle = device === "desktop" ? "w-full" : "w-[80vw] h-[40vh]";
return (
<div className="basis-[50%] flex flex-col items-center justify-center">
<img className={`${imageStyle}`} src={image} alt={alt} />
</div>
);
};

type DescriptionProps = {
projectName: string;
projectDescription: string;
techSkills: string[];
animeDirection: "LToR" | "RToL";
};
const Description = ({
projectName,
projectDescription,
techSkills,
animeDirection,
children,
}: PropsWithChildren<DescriptionProps>) => {
const device = useDeviceSize();
const containerRef = useRef<HTMLDivElement>(null);
const isInView = useInView(containerRef, {});

const headTextFontStyle = device === "desktop" ? "text-xl" : "text-lg";
const detailTextFontStyle = device === "desktop" ? "text-sm" : "text-xs";

return (
<div
className="flex flex-col items-start justify-center basis-[50%] backdrop-blur-sm px-4 py-2"
ref={containerRef}
>
<h1 className="flex items-center justify-center w-full mb-4 text-2xl">
<span className="pr-4 mr-4 border-r-2 max-w-[40%]">프로젝트 명 </span>
<span className={`flex-1 text-2xl ${headTextFontStyle}`}>
{projectName}
</span>
</h1>
<p className="flex flex-col flex-1 mb-4">
<span className="text-xl font-semibold">프로젝트 소개</span>
<span className={`ml-4 ${detailTextFontStyle}`}>
{projectDescription}
</span>
</p>
<div className="mb-4">
<p className="mb-2 font-semibold">사용한 기술 스택</p>
<ul className={`flex flex-col ml-4 gap-y-1 ${detailTextFontStyle}`}>
{techSkills.map((skill, idx) => (
<li
key={skill}
style={{
transform: isInView
? "none"
: `translateX(${
animeDirection === "LToR" ? "-300px" : "300px"
})`,
opacity: isInView ? 1 : 0,
transition: `all 0.5s cubic-bezier(0.17, 0.55, 0.55, 1) `,
transitionDelay: `${idx * 0.25 + 1.2}s`,
}}
>
{skill}
</li>
))}
</ul>
</div>
<p>
<Link to="/project">더 자세히 보기</Link>
{children}
</p>
</div>
);
};
ProjectContainer.ImageContainer = ImageContainer;
ProjectContainer.Description = Description;
1 change: 1 addition & 0 deletions fe/src/shared/libs/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./typing/useTypingAnimation";
export * from "./media-query/useDeviceSize";
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useRef } from "react";
import { FileDownloadButton } from "@/entities/projects/index";
import Contact from "@/entities/contact/index";

import MyProfile from "@/entities/profile/index";
import MyCareer from "@/entities/career/index";
import ContentContainer from "@/shared/ui/content-container/ContentContainer";
import Introduction from "@/entities/introduction/index";
import Project from "@/entities/projects/index";
import { ProjectContainer as Project } from "@/entities/projects/index";

// IMG Resources
import studyLogProjectImg from "@/shared/assets/images/study-log.png";
Expand Down Expand Up @@ -51,9 +51,9 @@ function ProjectsShowCase() {
<ContentContainer height="137.5vh">
<Introduction />
</ContentContainer>
{/* 프로필 */}
{/* 경력 */}
<ContentContainer>
<MyProfile />
<MyCareer />
</ContentContainer>
{/* Ready To Work Project */}
<ContentContainer>
Expand Down

0 comments on commit a0c08db

Please sign in to comment.