-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor : 포스트카드 인용숫자를 실제 서버 응답으로 대체 * Minor : X 아이콘 색상 변경 * Refactor : 앱바 컴포넌트 분리 * Refactor : 이미지 미리보기 컴포넌트 분리 * Refactor : 새 게시글 CTA 컴포넌트 분리 * Refactor : 술검색 컴포넌트 개선 * Refactor : 새 게시글 컴포넌트 분리 적용 * Refactor : 오타 수정 (fontWeight) * Refactor : 인터페이스명 명시적으로 변경
- Loading branch information
1 parent
c501f22
commit ad23935
Showing
8 changed files
with
173 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { AppBar, Button, IconButton, Toolbar, Typography } from "@mui/material"; | ||
import GoBackIcon from "@/assets/icons/GoBackIcon.svg"; | ||
import { MouseEventHandler, memo } from "react"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
interface CustomAppbarInterface { | ||
title: string; | ||
buttonTitle: string; | ||
disableButton?: boolean; | ||
onClickButton?: MouseEventHandler<HTMLButtonElement>; | ||
} | ||
|
||
const CustomAppbar = ({ | ||
title, | ||
buttonTitle, | ||
disableButton, | ||
onClickButton, | ||
}: CustomAppbarInterface) => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<AppBar position={"static"}> | ||
<Toolbar sx={{ display: "flex", justifyContent: "space-between" }}> | ||
<IconButton onClick={() => router.back()}> | ||
<GoBackIcon></GoBackIcon> | ||
</IconButton> | ||
<Typography variant="subtitle2" fontWeight={"bold"}> | ||
{title} | ||
</Typography> | ||
<Button | ||
disabled={disableButton} | ||
onClick={onClickButton} | ||
variant="text" | ||
sx={{ minWidth: 40, fontWeight: "medium" }} | ||
> | ||
{buttonTitle} | ||
</Button> | ||
</Toolbar> | ||
</AppBar> | ||
); | ||
}; | ||
|
||
export default memo(CustomAppbar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Box, BoxProps } from "@mui/material"; | ||
import React, { Ref, forwardRef } from "react"; | ||
|
||
interface PreviewImageByURLProps extends BoxProps { | ||
fileUrl: string | ArrayBuffer; | ||
} | ||
|
||
const PreviewImageByURL = ( | ||
{ fileUrl, sx }: PreviewImageByURLProps, | ||
ref: Ref<"div"> | ||
) => { | ||
return ( | ||
<Box | ||
sx={{ | ||
backgroundImage: `url(${fileUrl})`, | ||
width: "100%", | ||
height: 142, | ||
borderRadius: 4, | ||
border: "1px solid", | ||
borderColor: "gray.secondary", | ||
backgroundRepeat: "no-repeat", | ||
backgroundSize: "cover", | ||
backgroundPosition: "center", | ||
...sx, | ||
}} | ||
ref={ref} | ||
/> | ||
); | ||
}; | ||
|
||
export default forwardRef(PreviewImageByURL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ButtonBase, ButtonBaseProps } from "@mui/material"; | ||
import { ReactNode, Ref, forwardRef } from "react"; | ||
|
||
interface SquareIconButtonProps extends Omit<ButtonBaseProps, "children"> { | ||
iconComponent: ReactNode; | ||
children?: ReactNode; | ||
} | ||
|
||
const SquareIconButton = ({ | ||
children, | ||
iconComponent, | ||
...ButtonbaseProps | ||
}: SquareIconButtonProps,ref:Ref<HTMLButtonElement>) => { | ||
return ( | ||
<ButtonBase ref={ref} {...ButtonbaseProps} sx={ButtonBaseStyle}> | ||
{iconComponent} | ||
{children} | ||
</ButtonBase> | ||
); | ||
}; | ||
|
||
const ButtonBaseStyle = { | ||
bgcolor: "#F5F5F5", | ||
border: "1px solid", | ||
borderColor: "#E6E6E6", | ||
width: 72, | ||
height: 72, | ||
borderRadius: 1.5, | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
":hover": { | ||
bgcolor: "#F0F0F0", | ||
}, | ||
}; | ||
|
||
export default forwardRef(SquareIconButton); |
Oops, something went wrong.