Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
ChekiPopup、ボタンの色を変更できるようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
calmery committed Nov 22, 2020
1 parent d7bfb67 commit 4d93e37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/Cheki/InputImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const ChekiInputImage: React.FC<{
onCancel={handleOnClickTermsCancelButton}
enterText="同意する"
cancalText="同意しない"
primary="right"
>
<ExternalLink className="font-bold" href="/cheki/terms-of-service">
利用規約
Expand Down
25 changes: 19 additions & 6 deletions src/components/Cheki/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ interface PopupProps {
children: React.ReactNode;
enterText?: string;
cancalText?: string;
primary?: "left" | "right";
}

export const ChekiPopup: React.FC<PopupProps> = ({
Expand All @@ -76,6 +77,7 @@ export const ChekiPopup: React.FC<PopupProps> = ({
children,
onEnter,
onCancel,
primary = "left",
}) => {
const [popupTransition, setPopupTransition] = useState<
"bounceIn" | "bounceOut"
Expand Down Expand Up @@ -118,14 +120,25 @@ export const ChekiPopup: React.FC<PopupProps> = ({
>
<PopupInnerMessage css={Typography.M}>{children}</PopupInnerMessage>
<PopupInnerButtons>
{onCancel && (
<ChekiButton onClick={handleOnClickCancel}>
{cancalText || "キャンセル"}
{onCancel &&
(primary === "left" ? (
<ChekiButton onClick={handleOnClickCancel}>
{cancalText || "キャンセル"}
</ChekiButton>
) : (
<ChekiSubButton onClick={handleOnClickCancel}>
{cancalText || "キャンセル"}
</ChekiSubButton>
))}
{primary === "right" || !onCancel ? (
<ChekiButton onClick={handleOnClickEnter}>
{enterText || "わかった"}
</ChekiButton>
) : (
<ChekiSubButton onClick={handleOnClickEnter}>
{enterText || "わかった"}
</ChekiSubButton>
)}
<ChekiSubButton onClick={handleOnClickEnter}>
{enterText || "わかった"}
</ChekiSubButton>
</PopupInnerButtons>
</PopupInner>
</PopupContainer>
Expand Down

0 comments on commit 4d93e37

Please sign in to comment.