UNPKG

@kiwicom/smart-faq

Version:

Smart FAQ

47 lines (41 loc) 1.15 kB
// @flow import * as React from 'react'; import { Link } from 'react-router-dom'; import { Text, Heading } from '@kiwicom/orbit-components'; import css from 'styled-jsx/css'; import Card from '../../SmartFAQ/common/Card'; import type { FAQArticle_article } from './__generated__/FAQArticle_article.graphql'; type Props = {| article: FAQArticle_article, categoryId: ?string, isSearchResult: ?boolean, onClick: () => void, |}; const style = css` .title { margin-bottom: 4px; } `; const RawFAQArticle = (props: Props) => ( <Link data-cy="faq-article-link" to={ props.isSearchResult ? `/faq/search/article/${props.article.id}` : `/faq/${props.categoryId || ''}/article/${props.article.id}` } style={{ textDecoration: 'none', display: 'block' }} onClick={props.onClick} > <Card> <div className="title"> <Heading type="title3">{props.article.title || ''}</Heading> </div> <Text type="primary" size="normal" element="span"> {props.article.perex || ''} </Text> </Card> <style jsx>{style}</style> </Link> ); export default RawFAQArticle;