Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 공통 컴포넌트 버튼 색상 및 구조 변경 #82

Merged
merged 4 commits into from
Jul 10, 2024
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
2 changes: 1 addition & 1 deletion src/assets/svg/Delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions src/components/common/button/DeleteBtn.tsx

This file was deleted.

64 changes: 42 additions & 22 deletions src/components/common/button/settingBtn/SettingDeleteBtn.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,68 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';

import { smallIcon, bigIcon, SettingCss, smallSize, bigSize } from './settingBtnStyle';

import Icons from '@/assets/svg/index';

interface SettingDeleteBtnProps {
size: 'small' | 'big';
onClick?: () => void;
isHover: boolean;
isPressed: boolean;
onClick?: () => void;
isActive: boolean;
}

function SettingDeleteBtn({ isHover, isPressed, onClick }: SettingDeleteBtnProps) {
function SettingDeleteBtn({ size, onClick, isHover, isPressed, isActive }: SettingDeleteBtnProps) {
const StyledSettingDeleteIcon = styled(Icons.DeleteIcon)<{ size: string }>`
${({ size }) => (size === 'small' ? smallIcon : bigIcon)}
`;
return (
<SettingDeleteBtnLayout isHover={isHover} isPressed={isPressed} onClick={onClick}>
<StyledDeleteIcon />
<SettingDeleteBtnLayout size={size} onClick={onClick} isHover={isHover} isPressed={isPressed} isActive={isActive}>
<StyledSettingDeleteIcon size={size} />
</SettingDeleteBtnLayout>
);
}

export default SettingDeleteBtn;

const SettingDeleteBtnCss = css`
display: flex;
align-items: center;
justify-content: center;
width: 2.4rem;
height: 2.4rem;

border-radius: 8px;
`;

const SettingDeleteBtnLayout = styled.button<{ isHover: boolean; isPressed: boolean }>`
${SettingDeleteBtnCss}
background-color: ${({ theme, isPressed }) => (isPressed ? theme.palette.Primary : theme.palette.Blue.Blue1)};
const SettingDeleteBtnLayout = styled.button<{
size: string;
isHover: boolean;
isPressed: boolean;
isActive: boolean;
}>`
${SettingCss}
${({ size }) => (size === 'small' ? smallSize : bigSize)};
background-color: ${({ theme }) => theme.palette.Orange.Orange2};

${({ isHover, theme }) =>
isHover &&
css`
&:hover {
background-color: ${theme.palette.Blue.Blue3};
background-color: ${theme.palette.Orange.Orange4};
}
`}
`;

const StyledDeleteIcon = styled(Icons.DeleteIcon)`
width: 1.4rem;
height: 1.4rem;
${({ isActive, theme }) =>
isActive &&
css`
&:active {
background-color: ${theme.palette.Secondary};

path {
stroke: ${theme.palette.Grey.White};
}
}
`}

${({ isPressed, theme }) =>
isPressed &&
css`
background-color: ${theme.palette.Secondary};

path {
stroke: ${theme.palette.Grey.White};
}
`}
`;
8 changes: 7 additions & 1 deletion src/components/common/button/statusBtn/StatusStagingBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ function StatusStagingBtn() {
return (
<StatusStagingBtnLayout>
{!isCheckingPressed && (
<SettingDeleteBtn isHover={false} isPressed={isDeletePressed} onClick={handleSettingCheckClick} />
<SettingDeleteBtn
size="small"
isHover={false}
isActive={false}
isPressed={isDeletePressed}
onClick={handleSettingCheckClick}
/>
)}
{!isDeletePressed && (
<SettingCheckBtn
Expand Down
5 changes: 3 additions & 2 deletions src/components/common/modal/ModalHeaderBtn.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import styled from '@emotion/styled';

import DeleteBtn from '@/components/common/button/DeleteBtn';
import SettingDeleteBtn from '../button/settingBtn/SettingDeleteBtn';

import SettingCheckBtn from '@/components/common/button/settingBtn/SettingCheckBtn';
import { SizeType } from '@/types/textInputType';

function ModalHeaderBtn({ type }: SizeType) {
return (
<ModalHeaderBtnLayout>
<DeleteBtn />
<SettingDeleteBtn size="big" isHover isPressed={false} isActive />
{type === 'long' && <SettingCheckBtn type="progress" size="big" isHover isPressed={false} isActive />}
<SettingCheckBtn type="complete" size="big" isHover isPressed={false} isActive />
</ModalHeaderBtnLayout>
Expand Down
4 changes: 1 addition & 3 deletions src/pages/Setting.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import styled from '@emotion/styled';

import DeleteBtn from '@/components/common/button/DeleteBtn';
import DeleteCancelBtn from '@/components/common/button/DeleteCancelBtn';
import EnterBtn from '@/components/common/button/EnterBtn';
import OkayCancelBtn from '@/components/common/button/OkayCancelBtn';
Expand Down Expand Up @@ -29,14 +28,13 @@ function Setting() {
<TextBtn size="big" text="전체" color="BLUE" mode="LIGHT" isHover isPressed />
<TextBtn size="big" text="전체" color="BLUE" mode="DEFAULT" isHover isPressed />
<SortBtn text="최신 등록순" />
<DeleteBtn />
<DeleteCancelBtn status="delete" />
<EnterBtn isDisabled={false} />
<OkayCancelBtn type="okay" />
<ProgressBtn type="defaultProgress" />
<RefreshBtn isDisabled={false} />

<SettingDeleteBtn isHover isPressed />
<SettingDeleteBtn size="big" isHover isPressed={false} isActive />
<StatusDoneBtn />
<StatusInProgressBtn />
<StatusStagingBtn />
Expand Down
Loading