File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import cn from 'classnames'
33import { documentToReactComponents } from '@contentful/rich-text-react-renderer'
44import IconX from ' ../../assets/icons/ui-x-mark.svg'
55import IconCarretDown from '../../assets/icons/arrow-6px-carret-down-normal.svg'
6+ import { CONTENTFUL_NODE_TYPES } from '../../config/constants'
67import './FAQItem.scss'
78
89
@@ -25,6 +26,13 @@ class FAQItem extends Component {
2526 render ( ) {
2627 const { item} = this . props
2728 const { isOpen} = this . state
29+
30+ const FormattedHyperLink = ( { value, url } ) => < a href = { url } target = "_blank" className = "hyperlink-style" > { value } </ a >
31+ const options = {
32+ renderNode : { /* eslint-disable no-unused-vars*/
33+ [ CONTENTFUL_NODE_TYPES . HYPERLINK ] : ( node , children ) => < FormattedHyperLink value = { node . content [ 0 ] . value } url = { node . data . uri } />
34+ }
35+ }
2836 return (
2937 < div styleName = { cn ( 'accordion' , { 'is-open' : isOpen } ) } >
3038 < div styleName = "header" onClick = { this . toggle } >
@@ -33,7 +41,7 @@ class FAQItem extends Component {
3341 { isOpen ? < IconX styleName = "toggle-icon" /> : < IconCarretDown styleName = "toggle-icon" /> }
3442 </ div >
3543 </ div >
36- < div styleName = "content" > { documentToReactComponents ( item . fields . answer ) } </ div >
44+ < div styleName = "content" > { documentToReactComponents ( item . fields . answer , options ) } </ div >
3745 </ div >
3846 )
3947 }
Original file line number Diff line number Diff line change 6262 line-height : 20px ;
6363 text-align : left ;
6464 margin-bottom : 2 * $base-unit ;
65+
66+ a {
67+ cursor : pointer ;
68+ color : $tc-dark-blue ;
69+ & :hover {
70+ text-decoration : underline ;
71+ }
72+ }
6573}
6674
6775.accordion.is-open .content {
Original file line number Diff line number Diff line change @@ -992,4 +992,12 @@ export const REPORT_SESSION_LENGTH = 25 * 60 // 25 minutes (5 minutes less than
992992 */
993993export const DASHBOARD_FAQ_CONTENT_ID = process . env . DASHBOARD_FAQ_CONTENT_ID
994994export const CONTENTFUL_DELIVERY_KEY = process . env . CONTENTFUL_DELIVERY_KEY
995- export const CONTENTFUL_SPACE_ID = process . env . CONTENTFUL_SPACE_ID
995+ export const CONTENTFUL_SPACE_ID = process . env . CONTENTFUL_SPACE_ID
996+
997+
998+ /**
999+ * Contentful node types
1000+ */
1001+ export const CONTENTFUL_NODE_TYPES = {
1002+ HYPERLINK : 'hyperlink' ,
1003+ }
You can’t perform that action at this time.
0 commit comments