Skip to content

Commit

Permalink
#84 refactor: 마감 임박 스타일 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
MyungJiwoo committed Sep 24, 2024
1 parent 64d91e2 commit 79c1a28
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const Block = ({
<S.BlockContainer
marginValue={remove ? '0' : '1'}
dayCount={dDay ?? 999}
isDone={progress === '완료'}
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
Expand Down
42 changes: 34 additions & 8 deletions src/styles/DashboardStyled.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from 'styled-components';
import { styled, keyframes } from 'styled-components';
import theme from '../styles/Theme/Theme';
import rightArrowImg from '../img/rightarrow.png';

Expand All @@ -12,6 +12,21 @@ interface DashboardContainerProps {
text: string;
}

// 애니메이션 정의
const shake = keyframes`
/* 0% { transform: translateX(0); }
25% { transform: translate(-1.5px, -1.5px); }
50% { transform: translateX(1.5px); }
75% { transform: translate(-1.5px, -1.5px); }
100% { transform: translateX(0); } */
0% { transform: rotate(0deg); }
25% { transform: rotate(10deg)};
75%{transform: rotate(-10deg)};
100%{transform: rotate()(0deg)};
`;
export const DashboardContainer = styled.section<DashboardContainerProps>`
/* margin-bottom: 3.3125rem; */
/* overflow: hidden; */
Expand Down Expand Up @@ -175,7 +190,11 @@ export const GraphProgress = styled.div<{ blockProgress: number }>`
`;

/* 블록 스타일*/
export const BlockContainer = styled.div<{ marginValue: string; dayCount: number }>`
export const BlockContainer = styled.div<{
marginValue: string;
dayCount: number;
isDone: boolean;
}>`
background: ${theme.color.white};
padding: 1.375rem 1.375rem 1.375rem 1.375em;
border: 1px solid #f4f4f4;
Expand Down Expand Up @@ -210,13 +229,20 @@ export const BlockContainer = styled.div<{ marginValue: string; dayCount: number
}
span {
/* 날짜 색상 : 만료일 가까워지면 다른 스타일 */
font-size: ${theme.font.size.caption};
/* color: ${theme.color.gray}; */
/* font-weight: ${theme.font.weight.light}; */
/* 날짜 색상 : 만료일 가까워지면 빨갛고 두껍게 */
color: ${({ dayCount }) => (dayCount < 8 ? 'red' : theme.color.gray)};
font-weight: ${({ dayCount }) =>
dayCount < 4 ? theme.font.weight.bold : theme.font.weight.light};
color: ${theme.color.gray};
font-weight: ${theme.font.weight.light};
color: ${({ dayCount, isDone }) => (dayCount < 8 && !isDone ? 'red' : theme.color.gray)};
/* font-weight: ${({ dayCount }) =>
dayCount < 4 ? theme.font.weight.bold : theme.font.weight.light}; */
animation-name: ${({ dayCount, isDone }) => (dayCount < 8 && !isDone ? shake : 'none')};
animation-duration: 0.5s; /* 애니메이션 지속 시간 설정 */
animation-iteration-count: infinite; /* 애니메이션 반복 설정 */
}
&:hover {
Expand Down

0 comments on commit 79c1a28

Please sign in to comment.