Return

All tests / Blog/ArticlePanel index.tsx

100% Statements 17/17
100% Branches 0/0
100% Functions 2/2
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 711x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                         1x 2x                                               1x                                       2x  
import React from 'react';
import { MdSortByAlpha, MdAddLink, MdOutlineChecklist } from 'react-icons/md';
import { RxTable, RxUpload, RxStopwatch } from 'react-icons/rx';
import { BiPhotoAlbum } from 'react-icons/bi';
import { BsLock } from 'react-icons/bs';
import { CgProfile } from 'react-icons/cg';
import { useIntl } from 'react-intl';
import SearchInput from '@/components/SearchInput';
import styles from './panel.module.css';
import StarCounter from '../StarCounter';
import ViewCounter from '../ViewCounter';
import Tooltip from '@/components/Tooltip';
 
type Props = {
    readTime?: string;
};
 
/**
 * @example
 *     <TimeRead readTime="2" />;
 *
 * @param {string} readTime - The read time of the article
 * @returns {JSX.Element}
 */
const TimeRead = ({ readTime }: Props) => {
    const { formatMessage: f } = useIntl();
 
    return (
        <Tooltip>
            <Tooltip.Trigger>
                <div className={styles.readContainer} data-testid="read-time">
                    <RxStopwatch size={20} />
                    <span>{readTime}</span>
                </div>
            </Tooltip.Trigger>
            <Tooltip.Content>
                <span>{f({ id: 'blog.readtime', description: 'read time' }, { readTime })}</span>
            </Tooltip.Content>
        </Tooltip>
    );
};
 
/**
 * @example
 *     <ArticlePanel readTime="2" />;
 *
 * @param {string} readTime - The read time of the article
 * @returns {JSX.Element}
 */
const ArticlePanel = ({ readTime }: Props) => {
    return (
        <div className={styles.articleControls} data-testid="article-panel">
            <div className={styles.readTime}>
                <TimeRead readTime={readTime} />
                <ViewCounter />
                <StarCounter />
            </div>
            <MdSortByAlpha />
            <MdOutlineChecklist />
            <RxTable size={18} />
            <MdAddLink className={styles.rotate} />
            <BiPhotoAlbum size={18} />
            <BsLock size={18} />
            <CgProfile size={18} />
            <RxUpload size={18} />
            <SearchInput />
        </div>
    );
};
export default ArticlePanel;