Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/🐞-버그-리포트-템플릿.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: "\U0001F41E 버그 리포트 템플릿"
about: 프로젝트에서 발생하는 버그에 대해 명세합니다.
title: "[Bug] Issue title"
labels: "\U0001F41E BugFix"
assignees: ""
---

## 💬 버그 설명

문제가 생긴 상황을 간단히 설명해주세요.

## 🔁 재현 방법

문제가 어떻게 발생했는지 순서대로 작성해주세요.

## ⚙️ 기대 동작

정상적으로 어떤 동작을 기대했는지 설명해주세요.

## 📸 스크린샷 (선택사항)

## 📄 추가 정보

기타 참고할만한 정보나 자료가 있다면 자유롭게 작성해주세요.
3 changes: 3 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const nextConfig: NextConfig = {

return config;
},
images: {
remotePatterns: [new URL("https://upload.wikimedia.org/**")],
},
};

export default nextConfig;
3 changes: 3 additions & 0 deletions public/images/profile/default-profile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/app/example/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SelectType,
TextInput,
} from "@/components";
import Profile from "@/components/profile/profile";
import React, { ChangeEvent } from "react";

const Page = () => {
Expand Down Expand Up @@ -95,6 +96,14 @@ const Page = () => {
errorMsg="에러입니다"
/>
</section>

<br />
<section>
<Profile />
<Profile url="https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Allosaurus_BW.jpg/120px-Allosaurus_BW.jpg" />
</section>

<br />
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export { default as Icon } from "./icon/icon";
export { default as BlockGauge } from "./gauge/block-gauge";
export { default as DetailTaste } from "./taste/detail-taste";
export { default as ReviewTaste } from "./taste/review-taste";
export { default as Profile } from "./profile/profile";
export { default as Button } from "./button/basic-button";
export { default as ArrowButton } from "./button/arrow-button";
export { default as IconButton } from "./button/icon-button";
50 changes: 50 additions & 0 deletions src/components/profile/profile.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Meta, StoryObj } from "@storybook/nextjs";
import Profile from "./profile";

const meta: Meta<typeof Profile> = {
title: "Components/Profile",
component: Profile,
parameters: {
layout: "centered",
docs: {
description: {
component: "프로필 이미지 컴포넌트 입니다.",
},
},
},
tags: ["autodocs"],
argTypes: {
url: { control: { type: "text" } },
isEditing: { control: { type: "text" } },
className: { control: { type: "text" } },
},
};

export default meta;

type Story = StoryObj<typeof Profile>;

export const DefaultProfile: Story = {
args: {},
};

export const ImgProfile: Story = {
args: {
url: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Synthetic_Production_of_Penicillin_TR1468.jpg/120px-Synthetic_Production_of_Penicillin_TR1468.jpg",
},
};

export const NotEditingProfile: Story = {
args: {
url: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Synthetic_Production_of_Penicillin_TR1468.jpg/120px-Synthetic_Production_of_Penicillin_TR1468.jpg",
isEditing: false,
},
};

export const StyledProfile: Story = {
args: {
url: "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Synthetic_Production_of_Penicillin_TR1468.jpg/120px-Synthetic_Production_of_Penicillin_TR1468.jpg",
isEditing: false,
className: "border border-gray-800",
},
};
71 changes: 71 additions & 0 deletions src/components/profile/profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import Image from "next/image";
import DefaultProfile from "../../../public/images/profile/default-profile.svg";
import { cn } from "@/lib/utils";
import Icon from "../icon/icon";
import { ComponentProps } from "react";

interface ProfileProps extends ComponentProps<"input"> {
url?: string;
isEditing?: boolean;
className?: string;
}

/**
* 프로필 컴포넌트
* @author hwitae
* @param url 이미지 경로
* @param isEditing 이미지 업로드 기능 활성화 여부
* @param className 스타일
* @returns input
*/
const Profile = ({
url,
isEditing = true,
className,
...props
}: ProfileProps) => {
return (
<div className="group relative">
<div
className={cn(
"rounded-full bg-white",
isEditing && "hover:border hover:border-gray-300 hover:bg-gray-300",
className
)}
>
<label className="hover:cursor-pointer">
{url ? (
<Image
src={url}
width={164}
height={164}
alt="프로필 이미지"
className="h-[164px] w-[164px] rounded-full object-cover"
draggable={false}
priority
/>
) : (
<DefaultProfile width="164px" height="164px" />
)}
<input
id="uploadImg"
type="file"
accept="image/*"
className="hidden"
disabled={!isEditing}
{...props}
/>
{isEditing && (
<Icon
icon="CameraIcon"
size={"2xl"}
className="absolute left-1/2 right-4 top-1/2 hidden -translate-x-1/2 -translate-y-1/2 group-hover:block"
/>
)}
</label>
</div>
</div>
);
};

export default Profile;