Skip to content

Commit d146e94

Browse files
committed
[add] react-icon 인스톨, FaqStar 컴포넌트 추가
1 parent 6987277 commit d146e94

File tree

6 files changed

+143
-3
lines changed

6 files changed

+143
-3
lines changed

package-lock.json

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"react-daum-postcode": "^3.0.1",
2626
"react-dom": "^17.0.2",
2727
"react-draggable": "^4.4.4",
28+
"react-icons": "^4.3.1",
2829
"react-particles-js": "^3.6.0",
2930
"react-redux": "^7.2.6",
3031
"react-responsive": "^9.0.0-beta.6",

src/components/customer/Faq.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*customer > FQA 페이지 */
22

3-
import React, { useState, useEffect } from "react";
3+
import React, { useState} from "react";
44
import './faq.css'
55
import FaqAcco from './FaqAcco';
66
import Customer from './Customer';
7+
import FaqStar from './FaqStar';
78

89

910
export default function Faq() {
@@ -24,6 +25,9 @@ export default function Faq() {
2425
}
2526

2627

28+
29+
30+
2731
return(
2832
<>
2933

@@ -60,7 +64,7 @@ export default function Faq() {
6064
</div>{/* e: submenu */}
6165

6266
<FaqAcco currentMenu={currentMenu}/>
63-
67+
<FaqStar />
6468
</div>
6569
<div className='faqBottomBanner'>
6670
<img src="/images/academy/007.png" alt="배너이미지" />

src/components/customer/FaqStar.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import React, { useState, useEffect } from 'react';
2+
import { FaStar } from 'react-icons/fa';
3+
import styled from 'styled-components';
4+
const ARRAY = [0, 1, 2, 3, 4];
5+
6+
function Rating() {
7+
const [clicked, setClicked] = useState([false, false, false, false, false]);
8+
9+
const handleStarClick = index => {
10+
let clickStates = [...clicked];
11+
for (let i = 0; i < 5; i++) {
12+
clickStates[i] = i <= index ? true : false;
13+
}
14+
setClicked(clickStates);
15+
};
16+
return (
17+
<Wrap>
18+
<RatingText>보고 계신 답변에 얼마나 만족하시나요? 별점을 남겨주세요!</RatingText>
19+
<Stars className='faqStar'>
20+
{ARRAY.map((el, idx) => {
21+
return (
22+
<FaStar
23+
key={idx}
24+
size="25"
25+
onClick={() => handleStarClick(el)}
26+
className={clicked[el] && 'yellowStar'}
27+
/>
28+
);
29+
})}
30+
31+
</Stars>
32+
<RatingBtn onClick={()=>{alert('별점이 등록되었습니다.')}}>별점 남기기</RatingBtn>
33+
</Wrap>
34+
);
35+
}
36+
37+
export default Rating;
38+
39+
const Wrap = styled.div`
40+
display: flex;
41+
flex-direction: column;
42+
padding-top: 15px;
43+
margin: 0 0 150px 60px;
44+
`;
45+
46+
const RatingText = styled.div`
47+
color: #787878;
48+
font-size: 16px;
49+
padding-left: 10px;
50+
border-left: 2px solid #5ebf92;
51+
52+
53+
`;
54+
55+
const Stars = styled.div`
56+
display: flex;
57+
padding-top: 20px;
58+
59+
& svg {
60+
fill: gray;
61+
cursor: pointer;
62+
}
63+
64+
:hover svg {
65+
fill: #fcc419;
66+
}
67+
68+
& svg:hover ~ svg {
69+
fill: gray;
70+
}
71+
72+
.yellowStar {
73+
fill: #fcc419;
74+
}
75+
`;
76+
77+
const RatingBtn = styled.button`
78+
color: #636363;
79+
font-size: 14px;
80+
width: 110px;
81+
height:30px;
82+
border: 1px solid #5ebf92;
83+
border-radius: 5px;
84+
margin-top: 15px;
85+
86+
:hover{
87+
background-color : #5ebf92;
88+
opacity: 0.8;
89+
}
90+
`

src/components/customer/faq.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
/* FaqAcco.js */
7979

8080
.accoBox {
81-
margin: 0 50px 150px 50px;
81+
margin: 0 50px 50px 50px;
8282
}
8383
.accoBox .accoImg {
8484
width: 25px;

yarn.lock

+30
Original file line numberDiff line numberDiff line change
@@ -3825,6 +3825,13 @@
38253825
"resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
38263826
"version" "2.2.0"
38273827

3828+
"bindings@^1.5.0":
3829+
"integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="
3830+
"resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
3831+
"version" "1.5.0"
3832+
dependencies:
3833+
"file-uri-to-path" "1.0.0"
3834+
38283835
"bluebird@^3.5.5":
38293836
"integrity" "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
38303837
"resolved" "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz"
@@ -6726,6 +6733,19 @@
67266733
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
67276734
"version" "1.0.0"
67286735

6736+
"fsevents@^1.2.7":
6737+
"integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw=="
6738+
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz"
6739+
"version" "1.2.13"
6740+
dependencies:
6741+
"bindings" "^1.5.0"
6742+
"nan" "^2.12.1"
6743+
6744+
"fsevents@^2.1.2", "fsevents@^2.3.2", "fsevents@~2.3.2":
6745+
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
6746+
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
6747+
"version" "2.3.2"
6748+
67296749
"function-bind@^1.1.1":
67306750
"integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
67316751
"resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
@@ -9710,6 +9730,11 @@
97109730
"resolved" "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz"
97119731
"version" "0.0.7"
97129732

9733+
"nan@^2.12.1":
9734+
"integrity" "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
9735+
"resolved" "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz"
9736+
"version" "2.15.0"
9737+
97139738
"nanoid@^3.3.1":
97149739
"integrity" "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw=="
97159740
"resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz"
@@ -11375,6 +11400,11 @@
1137511400
"resolved" "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz"
1137611401
"version" "3.2.0"
1137711402

11403+
"react-icons@^4.3.1":
11404+
"integrity" "sha512-cB10MXLTs3gVuXimblAdI71jrJx8njrJZmNMEMC+sQu5B/BIOmlsAjskdqpn81y8UBVEGuHODd7/ci5DvoSzTQ=="
11405+
"resolved" "https://registry.npmjs.org/react-icons/-/react-icons-4.3.1.tgz"
11406+
"version" "4.3.1"
11407+
1137811408
"react-is@^16.12.0":
1137911409
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
1138011410
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"

0 commit comments

Comments
 (0)