Skip to content

Commit b653c73

Browse files
committed
Adds FAQ at BSIC Incubator page in Blockchain community
1 parent 048c9d0 commit b653c73

File tree

10 files changed

+575
-2
lines changed

10 files changed

+575
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Actions powering the UI state of Cognitive community's Resources page.
3+
*/
4+
5+
import { createActions } from 'redux-actions';
6+
7+
/**
8+
* Payload creator for the action that hides (closes) all FAQ items.
9+
*/
10+
function closeAllFaqItems() {
11+
return null;
12+
}
13+
14+
/**
15+
* Payload creator for the action that toggles (shows/hides) the specified FAQ
16+
* item.
17+
* @param {Number} index 0-based index of FAQ item in the page.
18+
* @param {Boolean} show Whether the item should be shown or hidden.
19+
* @param {Boolean} closeOthers Tells, whether other FAQ items should be closed.
20+
* @return {Object} payload.
21+
*/
22+
function toggleFaqItem(index, show, closeOthers) {
23+
return { closeOthers, index, show };
24+
}
25+
26+
export default createActions({
27+
PAGE: {
28+
COMMUNITIES: {
29+
BLOCKCHAIN: {
30+
BSIC_INCUBATOR: {
31+
CLOSE_ALL_FAQ_ITEMS: closeAllFaqItems,
32+
TOGGLE_FAQ_ITEM: toggleFaqItem,
33+
},
34+
},
35+
},
36+
},
37+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import PT from 'prop-types';
2+
import React from 'react';
3+
4+
import Carret from 'assets/images/communities/cognitive/resources/carret.svg';
5+
6+
import './style.scss';
7+
8+
export default function FaqItem({
9+
children,
10+
open,
11+
question,
12+
toggle,
13+
}) {
14+
return (
15+
<div styleName="container">
16+
<div
17+
onClick={() => toggle(!open)}
18+
role="button"
19+
styleName="question"
20+
tabIndex={0}
21+
>
22+
{question}
23+
<Carret
24+
transform={open ? null : 'scale(1, -1)'}
25+
/>
26+
</div>
27+
{ open ? <div styleName="answer">{children}</div> : null }
28+
</div>
29+
);
30+
}
31+
32+
FaqItem.defaultProps = {
33+
children: null,
34+
open: false,
35+
question: '',
36+
};
37+
38+
FaqItem.propTypes = {
39+
children: PT.node,
40+
open: PT.bool,
41+
question: PT.string,
42+
toggle: PT.func.isRequired,
43+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@import "~styles/mixins";
2+
3+
.answer {
4+
@include tc-body-md;
5+
6+
background: $tc-gray-neutral-light;
7+
padding: 10px 20px;
8+
9+
a {
10+
color: $tc-dark-blue;
11+
12+
&:visited {
13+
color: $tc-purple;
14+
}
15+
}
16+
17+
h3 {
18+
margin: 20px 0 0;
19+
}
20+
21+
p {
22+
margin: 10px 0;
23+
}
24+
25+
strong {
26+
font-weight: bold;
27+
}
28+
29+
li {
30+
list-style-type: disc;
31+
margin-left: 20px;
32+
}
33+
}
34+
35+
.container {
36+
margin: 10px 0;
37+
}
38+
39+
.question {
40+
@include tc-body-lg;
41+
42+
align-items: center;
43+
background: $tc-dark-blue;
44+
border: none;
45+
color: white;
46+
cursor: pointer;
47+
display: flex;
48+
justify-content: space-between;
49+
outline: none;
50+
padding: 15px 20px;
51+
position: relative;
52+
}

0 commit comments

Comments
 (0)