Skip to content

Commit

Permalink
Merge pull request #626 from sparcs-kaist/#620-home-2023-fall
Browse files Browse the repository at this point in the history
#620 `Button` 와 `WhiteContainer` Component에 `css` props 추가
  • Loading branch information
14KGun authored Sep 8, 2023
2 parents f285d83 + ab0dee3 commit 0fe8f5f
Show file tree
Hide file tree
Showing 34 changed files with 309 additions and 199 deletions.
31 changes: 10 additions & 21 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
import { ReactNode } from "react";
import { HTMLProps, ReactNode } from "react";

import useHoverProps from "hooks/theme/useHoverProps";

import theme, { Font } from "tools/theme";
import theme from "tools/theme";

type ButtonType = "purple" | "purple_inset" | "gray" | "white";

type ButtonProps = {
type?: ButtonType;
disabled?: boolean;
width?: string;
padding?: string | number;
radius?: number;
font?: Font;
onClick?: () => void;
className?: string;
children?: ReactNode;
};
} & HTMLProps<HTMLDivElement>;

const Button = ({
type,
disabled = false,
width,
padding,
radius,
font,
onClick,
className,
children,
onClick,
...divProps
}: ButtonProps) => {
const [hoverProps, isHover, isClicked] = useHoverProps();

Expand Down Expand Up @@ -71,23 +63,20 @@ const Button = ({
}
};

const style: CSS = {
...font,
width: width,
padding: padding,
borderRadius: radius,
const style = {
transitionDuration: theme.duration,
textAlign: "center" as const,
...theme.cursor(disabled),
textAlign: "center",
...getColor(),
};

return (
<div
onClick={disabled ? undefined : onClick}
style={style}
css={style}
className={className}
onClick={disabled ? undefined : onClick}
{...hoverProps}
{...divProps}
>
{children}
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/components/ModalPopup/Body/BodyChatReportDone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ const BodyChatReportDone = ({ onChangeIsOpen }: BodyChatReportDoneProps) => {
</div>
<Button
type="purple_inset"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={() => onChangeIsOpen?.(false)}
>
확인
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/Body/BodyChatReportSelectType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,24 @@ const BodyChatReportSelectType = ({
<div css={styleButtons}>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={clearReportedId}
>
이전
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={handleSubmit}
disabled={!!inValidMessage}
>
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/Body/BodyChatReportSelectUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,24 @@ const BodyChatReportSelectUser = ({
<div css={styleButtons}>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => onChangeIsOpen?.(false)}
>
돌아가기
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={() => setReportedId(selectedUser)}
disabled={!selectedUser}
>
Expand Down
16 changes: 10 additions & 6 deletions src/components/ModalPopup/Body/BodyRoomSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,11 @@ const BodyRoomSelection = ({ roomInfo }: BodyRoomSelectionProps) => {
<Button
type="purple"
disabled={isRoomFull || isDepart || isAlreadyPart || isMaxPart}
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={requestJoin}
>
{isAlreadyPart
Expand All @@ -223,9 +225,11 @@ const BodyRoomSelection = ({ roomInfo }: BodyRoomSelectionProps) => {
<LinkLogin redirect={`/home/${roomInfo?._id}`}>
<Button
type="purple"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
>
로그인 후 참여 신청
</Button>
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/ModalChatCancel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,24 @@ const ModalChatCancel = ({ roomId, ...modalProps }: ModalChatCancelProps) => {
>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => modalProps?.onChangeIsOpen?.(false)}
>
돌아가기
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={onClickOk}
>
취소하기
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/ModalChatPayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,24 @@ const ModalChatSettlement = ({
>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => modalProps.onChangeIsOpen?.(false)}
>
돌아가기
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={onClickOk}
disabled={settlementStatusForMe !== "send-required"}
>
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/ModalChatSaveAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,24 @@ const ModalChatSaveAcount = ({
>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => modalProps.onChangeIsOpen?.(false)}
>
돌아가기
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={onSubmit}
>
저장하기
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/ModalChatSettlement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,24 @@ const ModalChatSettlement = ({
<div css={styleButtons}>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => modalProps.onChangeIsOpen?.(false)}
>
돌아가기
</Button>
<Button
type="purple_inset"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={onClickOk}
disabled={!isValidAccount}
>
Expand Down
20 changes: 12 additions & 8 deletions src/components/ModalPopup/ModalMypageModify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ const ModalMypageModify = ({
<div css={styleButton}>
<Button
type="gray"
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14,
}}
onClick={() => modalProps.onChangeIsOpen?.(false)}
>
{t("page_modify.cancel")}
Expand All @@ -264,10 +266,12 @@ const ModalMypageModify = ({
!isEditable ||
(nickname === loginInfo?.nickname && account === loginInfo?.account)
}
width="calc(50% - 5px)"
padding="10px 0 9px"
radius={8}
font={theme.font14_bold}
css={{
width: "calc(50% - 5px)",
padding: "10px 0 9px",
borderRadius: "8px",
...theme.font14_bold,
}}
onClick={handleEditProfile}
>
{t("page_modify.modify")}
Expand Down
Loading

0 comments on commit 0fe8f5f

Please sign in to comment.