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

[FEAT] StagingArea 퍼블리싱 #73

Merged
merged 8 commits into from
Jul 10, 2024
27 changes: 13 additions & 14 deletions src/components/common/BtnTask/BtnTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { css, Theme } from '@emotion/react';
import styled from '@emotion/styled';
import React, { useState } from 'react';

import BtnDate from '../BtnDate/BtnDate';
import StatusDoneBtn from '../button/statusBtn/StatusDoneBtn';
import StatusInProgressBtn from '../button/statusBtn/StatusInProgressBtn';
import StatusStagingBtn from '../button/statusBtn/StatusStagingBtn';
import StatusTodoBtn from '../button/statusBtn/StatusTodoBtn';

import Icons from '@/assets/svg/index';
import BtnDate from '@/components/common/BtnDate/BtnDate';
import StatusDoneBtn from '@/components/common/button/statusBtn/StatusDoneBtn';
import StatusInProgressBtn from '@/components/common/button/statusBtn/StatusInProgressBtn';
import StatusStagingBtn from '@/components/common/button/statusBtn/StatusStagingBtn';
import StatusTodoBtn from '@/components/common/button/statusBtn/StatusTodoBtn';

interface BtnTaskProps {
btnType: number;
btnType: 'staging' | 'target' | 'delayed';
status?: string;
isDescription?: boolean;
}
Expand All @@ -21,7 +20,7 @@ interface BorderColorProps {
isClicked: boolean;
iconHovered: boolean;
theme: Theme;
btnType: number;
btnType: string;
}

function BtnTask(props: BtnTaskProps) {
Expand Down Expand Up @@ -65,19 +64,19 @@ function BtnTask(props: BtnTaskProps) {
};

const renderStatusButton = () => {
if (btnType === 3) {
if (btnType === 'delayed') {
return <StagingIconHoverIndicator />;
}

if (!iconHovered && !iconClicked) {
return <IconHoverIndicator />;
}

if (btnType === 1) {
if (btnType === 'staging') {
return <StatusStagingBtn />;
}

if (btnType === 2) {
if (btnType === 'target') {
switch (status) {
case 'Done':
return <StatusDoneBtn />;
Expand All @@ -104,7 +103,7 @@ function BtnTask(props: BtnTaskProps) {
{isDescription && <IconFile />}
넛쉘 UT 진행하기
</BtnTaskTextWrapper>
<BtnDate date="2024.07.11" time="22:22" size="small" isDelayed={btnType === 3} />
<BtnDate date="2024.07.11" time="22:22" size="small" isDelayed={btnType === 'delayed'} />
</BtnTaskContainer>
<IconHoverContainer
onClick={handleIconClick}
Expand All @@ -125,7 +124,7 @@ const getBorderColor = ({ isHovered, isClicked, iconHovered, theme, btnType }: B
const clickColor = theme.palette.Primary;
const orangeColor = theme.palette.Orange.Orange8;
let borderColor = defaultColor;
if (btnType === 3) {
if (btnType === 'delayed') {
borderColor = orangeColor;
} else if (iconHovered || isHovered) {
borderColor = hoverColor;
Expand All @@ -141,7 +140,7 @@ const BtnTaskLayout = styled('div', { target: 'BtnTaskLayout' })<{
isClicked: boolean;
isHovered: boolean;
iconHovered: boolean;
btnType: number;
btnType: string;
}>`
display: flex;
align-items: center;
Expand Down
87 changes: 87 additions & 0 deletions src/components/common/StagingArea/StagingArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import styled from '@emotion/styled';

import BtnTask from '@/components/common/BtnTask/BtnTask';
import ScrollGradient from '@/components/common/ScrollGradient';
import StagingAreaSetting from '@/components/common/StagingArea/StagingAreaSetting';
import TextInputStaging from '@/components/common/textbox/TextInputStaging';

function StagingArea() {
return (
<StagingAreaLayout>
<StagingAreaContainer>
<StagingAreaUpContainer>
<StagingAreaTitle>쏟아내기</StagingAreaTitle>
<StagingAreaTaskContainer>
<StagingAreaSetting />
<BtnTaskContainer>
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<BtnTask btnType="staging" />
<ScrollGradient />
</BtnTaskContainer>
</StagingAreaTaskContainer>
</StagingAreaUpContainer>
<TextInputStaging />
</StagingAreaContainer>
</StagingAreaLayout>
);
}

export default StagingArea;

const StagingAreaLayout = styled.div`
display: inline-flex;
gap: 0.8rem;
align-items: center;
padding: 0 0.7rem;

border-right: 1px solid ${({ theme }) => theme.palette.Grey.Grey3};
border-radius: 0 12px 12px 0;
`;

const StagingAreaContainer = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
height: 76.8rem;
padding-bottom: 2.8rem;
`;

const StagingAreaUpContainer = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
align-self: stretch;
`;

const StagingAreaTitle = styled.div`
display: flex;
gap: 0.8rem;
align-items: center;
justify-content: center;
padding: 2.8rem 3.6rem 2.1rem 1.2rem;
${({ theme }) => theme.fontTheme.HEADLINE_02};
`;

const StagingAreaTaskContainer = styled.div`
display: flex;
flex-direction: column;
gap: 1.3rem;
align-items: flex-start;
align-self: stretch;
`;

const BtnTaskContainer = styled.div`
width: 100%;
height: 56.7rem;
overflow: scroll;
`;
55 changes: 55 additions & 0 deletions src/components/common/StagingArea/StagingAreaSetting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import styled from '@emotion/styled';
import { useState } from 'react';

import ArrangeBtn from '../arrangeBtn/ArrangeBtn';
import TextBtn from '../button/textBtn/TextBtn';

function StagingAreaSetting() {
const [activeButton, setActiveButton] = useState<'전체' | '취소'>('전체');

const handleButtonClick = (button: '전체' | '취소') => {
setActiveButton(button);
};

return (
<StagingAreaSettingLayout>
<TextBtnContainer>
<TextBtn
size="small"
text="전체"
color={activeButton === '전체' ? 'BLUE' : 'WHITE'}
mode={activeButton === '전체' ? 'DEFAULT' : 'LIGHT'}
isHover
isPressed
onClick={() => handleButtonClick('전체')}
/>
<TextBtn
size="small"
text="취소"
color={activeButton === '취소' ? 'BLUE' : 'WHITE'}
mode={activeButton === '취소' ? 'DEFAULT' : 'LIGHT'}
isHover
isPressed
onClick={() => handleButtonClick('취소')}
/>
Comment on lines +17 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<TextBtn
size="small"
text="전체"
color={activeButton === '전체' ? 'BLUE' : 'WHITE'}
mode={activeButton === '전체' ? 'DEFAULT' : 'LIGHT'}
isHover
isPressed
onClick={() => handleButtonClick('전체')}
/>
<TextBtn
size="small"
text="취소"
color={activeButton === '취소' ? 'BLUE' : 'WHITE'}
mode={activeButton === '취소' ? 'DEFAULT' : 'LIGHT'}
isHover
isPressed
onClick={() => handleButtonClick('취소')}
/>
{(['전체', '취소'] as const).map((button) => (
<TextBtn
key={button}
size="small"
text={button}
color={activeButton === button ? 'BLUE' : 'WHITE'}
mode={activeButton === button ? 'DEFAULT' : 'LIGHT'}
isHover
isPressed
onClick={() => setActiveButton(button)}
/>
))}

여길 이렇게 써보는 방식은 어떨까요 ??
반복되는 코드들도 사라지고 handleButtonClick 도 사라져도 되니 더 깔끔할 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 짱짱 바로 반영할게요 map을 생각을 못했다!!

</TextBtnContainer>
<ArrangeBtn type="set" mode="DISABLED" color="WHITE" size="small" />
</StagingAreaSettingLayout>
);
}

export default StagingAreaSetting;

const StagingAreaSettingLayout = styled.div`
display: flex;
align-items: center;
align-self: stretch;
justify-content: space-between;
`;

const TextBtnContainer = styled.div`
display: flex;
gap: 0.4rem;
align-items: center;
padding-left: 0.4rem;
`;
4 changes: 2 additions & 2 deletions src/components/common/button/EnterBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import styled from '@emotion/styled';
import Icons from '@/assets/svg/index';

interface EnterBtnProps {
isDisabled: boolean;
isDisabled?: boolean;
}

function EnterBtn({ isDisabled }: EnterBtnProps) {
function EnterBtn({ isDisabled = false }: EnterBtnProps) {
return (
<EnterBtnLayout isDisabled={isDisabled} disabled={isDisabled}>
<StyledIcon />
Expand Down
5 changes: 3 additions & 2 deletions src/components/common/button/textBtn/TextBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { smallSize, bigSize } from './textBtnStyle';

import { TextBtnType } from '@/types/textBtnType';

function TextBtn({ size, text, color, mode, isHover, isPressed }: TextBtnType) {
function TextBtn({ size, text, color, mode, isHover, isPressed, onClick }: TextBtnType) {
const StyledTextBtn = styled.div<{
size: string;
color: 'BLUE' | 'WHITE' | 'BLACK';
Expand Down Expand Up @@ -38,8 +38,9 @@ function TextBtn({ size, text, color, mode, isHover, isPressed }: TextBtnType) {
}
`}
`;

return (
<StyledTextBtn size={size} color={color} mode={mode} isHover={isHover} isPressed={isPressed}>
<StyledTextBtn size={size} color={color} mode={mode} isHover={isHover} isPressed={isPressed} onClick={onClick}>
{text}
</StyledTextBtn>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/button/textBtn/textBtnStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const smallSize = css`
height: 2.6rem;

${textButtonCss}
${theme.fontTheme.CAPTION_01}
${theme.fontTheme.CAPTION_02}
`;

export const bigSize = css`
Expand Down
15 changes: 6 additions & 9 deletions src/components/common/textbox/TextInputStaging.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import styled from '@emotion/styled';

import BtnStagingDate from '../BtnDate/BtnStagingDate';
import EnterBtn from '../button/EnterBtn';

function TextInputStaging() {
return (
<StagingLayout>
<TextArea placeholder="해야하는 일들을 쏟아내보세요." />
<BtnWrapper>
<TmpBtn />
<TmpBtn />
<BtnStagingDate />
<EnterBtn />
</BtnWrapper>
</StagingLayout>
);
Expand Down Expand Up @@ -34,6 +37,7 @@ const TextArea = styled.textarea`
&:focus {
outline: none;
}
resize: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헤헤 감사합니당

`;

const BtnWrapper = styled.div`
Expand All @@ -44,11 +48,4 @@ const BtnWrapper = styled.div`
height: fit-content;
`;

/** 임시 버튼 */
const TmpBtn = styled.div`
width: 5rem;
height: 2.2rem;

background-color: ${({ theme }) => theme.palette.Grey.Grey6};
`;
export default TextInputStaging;
13 changes: 8 additions & 5 deletions src/pages/Today.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import StatusStagingBtn from '@/components/common/button/statusBtn/StatusStaging
import StatusTodoBtn from '@/components/common/button/statusBtn/StatusTodoBtn';
import NavBar from '@/components/common/NavBar';
import ScrollGradient from '@/components/common/ScrollGradient';
import StagingArea from '@/components/common/StagingArea/StagingArea';
import TextboxDailydate from '@/components/common/textbox/TextboxDailydate';
import TextboxInput from '@/components/common/textbox/TextboxInput';
import TextInputDesc from '@/components/common/textbox/TextInputDesc';
Expand All @@ -22,17 +23,19 @@ function Today() {

<ScrollGradient />

<BtnTask btnType={1} isDescription />
<StagingArea />

<BtnTask btnType="staging" isDescription />

<p>Done</p>
<BtnTask btnType={2} status="Done" />
<BtnTask btnType="target" status="Done" />
<p>InProgress</p>
<BtnTask btnType={2} status="InProgress" />
<BtnTask btnType="target" status="InProgress" />
<p>Todo(default)</p>
<BtnTask btnType={2} />
<BtnTask btnType="target" />

<p>Staging</p>
<BtnTask btnType={3} />
<BtnTask btnType="delayed" />

<p>Done</p>
<StatusDoneBtn />
Expand Down
1 change: 1 addition & 0 deletions src/types/textBtnType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface TextBtnType {
text: string;
isHover: boolean;
isPressed: boolean;
onClick?: () => void;
}
Loading