File size: 1,142 Bytes
6337686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import React from 'react'
import { SourceAttribution } from '@/lib/bots/bing/types'

export interface LearnMoreProps {
  sourceAttributions?: SourceAttribution[]
}

export function LearnMore({ sourceAttributions }: LearnMoreProps) {
  if (!sourceAttributions?.length) {
    return null
  }

  return (
    <div className="learn-more-root" role="list" aria-label="了解详细信息:">
      <div className="learn-more">了解详细信息:</div>
      <div className="attribution-container">
        <div className="attribution-items">
          {sourceAttributions.map((attribution, index) => {
            const { providerDisplayName, seeMoreUrl } = attribution
            const { host } = new URL(seeMoreUrl)
            return (
              <a
                key={index}
                className="attribution-item"
                target="_blank"
                role="listitem"
                href={seeMoreUrl}
                title={providerDisplayName}
                tabIndex={index}
              >
                {index + 1}. {host}
              </a>
            )
          })}
        </div>
      </div>
    </div>
  )
}