MCPcopy Create free account
hub / github.com/github/docs / ArticleList

Function ArticleList

components/landing/ArticleList.tsx:19–94  ·  view source on GitHub ↗
({
  title,
  viewAllHref,
  viewAllTitleText,
  articles,
}: ArticleListPropsT)

Source from the content-addressed store, hash-verified

17}
18
19export const ArticleList = ({
20 title,
21 viewAllHref,
22 viewAllTitleText,
23 articles,
24}: ArticleListPropsT) => {
25 const { t } = useTranslation('product_landing')
26 const { page } = useMainContext()
27 return (
28 <>
29 {title && (
30 <div className="mb-4 d-flex flex-items-baseline">
31 <h2 className={cx('f4 text-semibold')}>{title}</h2>
32 {viewAllHref && (
33 <Link
34 href={viewAllHref}
35 className="ml-4"
36 {...(viewAllTitleText ? { 'aria-label': `${page.title} - ${viewAllTitleText}` } : {})}
37 >
38 {t('view')} <ArrowRightIcon size={14} className="v-align-middle" />
39 </Link>
40 )}
41 </div>
42 )}
43
44 <ActionList as="ul" data-testid="article-list" variant="full">
45 {articles.map((link) => {
46 return (
47 <ActionList.Item
48 as="li"
49 key={link.href}
50 className={cx('width-full border-top')}
51 sx={{
52 borderRadius: 0,
53 ':hover': {
54 borderRadius: 0,
55 },
56 }}
57 >
58 <BumpLink
59 as={Link}
60 href={link.href}
61 className="py-3"
62 title={
63 !link.hideIntro && link.intro ? (
64 <h3 className="f4" data-testid="link-with-intro-title">
65 <span>{link.fullTitle ? link.fullTitle : link.title}</span>
66 </h3>
67 ) : (
68 <span className="f4 text-bold d-block" data-testid="link-with-intro-title">
69 {link.fullTitle ? link.fullTitle : link.title}
70 </span>
71 )
72 }
73 >
74 {!link.hideIntro && link.intro && (
75 <TruncateLines as="p" maxLines={2} className="color-fg-muted mb-0 mt-1">
76 <span data-testid="link-with-intro-intro">{link.intro}</span>

Callers

nothing calls this directly

Calls 2

useTranslationFunction · 0.90
useMainContextFunction · 0.90

Tested by

no test coverage detected