All files / src/components/RepoDocs RepoDocs.js

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

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                        1x 14x 14x   14x                   22x                        
import React from 'react';
import { useTranslation } from 'react-i18next';
import useRepoDocs from './useRepoDocs';
import RepoDocLinks from './RepoDocLinks';
import './RepoDocs.css';
 
/**
 * Renders the RepoDocs section listing projects that have linked documentation.
 * Shows an empty-state card when no projects with docs are found.
 *
 * @returns {JSX.Element}
 */
const RepoDocs = () => {
  const { t } = useTranslation();
  const projectsWithDocs = useRepoDocs();
 
  return (
    <div className="repo-docs-container" id="RepoDocs">
      <h2>{t('repoDocs')}</h2>
      <div className="repo-docs-list">
        {projectsWithDocs.length === 0 ? (
          <div className="repo-docs-card">
            <p>{t('noRepoDocs')}</p>
          </div>
        ) : (
          projectsWithDocs.map((p, idx) => (
            <div className="repo-docs-card" key={idx}>
              <h3>{p.name}</h3>
              <RepoDocLinks project={p} />
            </div>
          ))
        )}
      </div>
    </div>
  );
};
 
export default RepoDocs;