-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddGuideSecondKr.tsx
More file actions
101 lines (85 loc) · 2.7 KB
/
AddGuideSecondKr.tsx
File metadata and controls
101 lines (85 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { useEffect } from 'react';
import { AddOkrCardWrapper, EmptyKeyResultCard } from '../../styles/KeyResultCardStyle';
import { IAddKrFlowProps } from '../../types/KrInfoTypes';
import GuideSecondKeyResultCard from '../addKr/GuideSecondKeyResultCard';
const AddGuideSecondKr = ({
objInfo,
clickedCard,
krListInfo,
setKrListInfo,
onValidateNextStep,
}: IAddKrFlowProps) => {
const { objTitle } = objInfo;
const secondKrList = [0, 1, 2];
useEffect(() => {
const isValid =
krListInfo.filter((kr) => {
return clickedCard.includes(kr.krIdx);
}).length ===
krListInfo.filter((kr) => {
const { krTarget, krMetric } = kr;
return krTarget && krMetric;
}).length;
onValidateNextStep(isValid);
}, [krListInfo, clickedCard]);
return (
<section css={AddGuideKrContainer}>
<StSecondAddGuideKrTxt>
{'달에 탐사선을 쏘아올릴 마음으로, 목표를 측정할 수 있는 핵심 지표를 설정해주세요'}
</StSecondAddGuideKrTxt>
<StSubGuideTxt>
moonshot에서 설정되는 목표 값은 70%에 도달할 시 완료로 간주되어요
</StSubGuideTxt>
<StObjTitleBox>
<p>{objTitle}</p>
</StObjTitleBox>
<AddOkrCardWrapper>
{secondKrList.map((indexOfCard) => {
return clickedCard.includes(indexOfCard) ? (
<GuideSecondKeyResultCard
key={indexOfCard}
cardIdx={indexOfCard}
krListInfo={krListInfo}
setKrListInfo={setKrListInfo}
/>
) : (
<EmptyKeyResultCard key={indexOfCard} />
);
})}
</AddOkrCardWrapper>
</section>
);
};
export default AddGuideSecondKr;
const AddGuideKrContainer = css`
display: flex;
flex-direction: column;
align-items: center;
`;
const StAddGuideKrTxt = styled.h1`
color: ${({ theme }) => theme.colors.gray_000};
text-align: center;
white-space: pre-line;
${({ theme }) => theme.fonts.title_20_semibold};
`;
const StSecondAddGuideKrTxt = styled(StAddGuideKrTxt)`
margin: 1rem 0 0.4rem;
`;
const StSubGuideTxt = styled.p`
margin-bottom: 1.6rem;
color: ${({ theme }) => theme.colors.sub_mint};
${({ theme }) => theme.fonts.body_12_medium};
`;
const StObjTitleBox = styled.div`
display: flex;
align-items: center;
width: fit-content;
height: 4.2rem;
padding: 0.7rem 0.5rem ${({ theme }) => theme.fonts.title_16_semibold};
margin-bottom: 3rem;
color: ${({ theme }) => theme.colors.main_purple};
border-bottom: 1px solid ${({ theme }) => theme.colors.main_purple};
${({ theme }) => theme.fonts.title_16_semibold};
`;