MCPcopy Create free account
hub / github.com/BetterECNU/SharedCourses / CourseCodeTag

Function CourseCodeTag

src/theme/DocCard/CourseCodeTag.js:9–44  ·  view source on GitHub ↗
({ code, linkable = true })

Source from the content-addressed store, hash-verified

7 * 用于显示课程编号和 Plus 跳转入口
8 */
9export default function CourseCodeTag({ code, linkable = true }) {
10 if (!code) {
11 return null;
12 }
13
14 const plusHref = `https://plus.myecnu.org/#/course?id=${encodeURIComponent(code)}`;
15 const plusIcon = (
16 <svg
17 className={styles.plusIconSvg}
18 viewBox="0 0 16 16"
19 aria-hidden="true"
20 focusable="false"
21 >
22 <path d="M8 3.25v9.5M3.25 8h9.5" />
23 </svg>
24 );
25 const Wrapper = linkable ? Link : 'span';
26 const wrapperProps = linkable
27 ? {
28 href: plusHref,
29 title: '点击前往 Plus 查看开课情况',
30 'aria-label': '跳转到 Plus',
31 }
32 : {};
33
34 return (
35 <Wrapper className={styles.courseCodeLink} {...wrapperProps}>
36 <span className={styles.courseCodeTag}>
37 <span className={styles.courseCodeText}>{code}</span>
38 </span>
39 {linkable && <span className={styles.plusIconWrapper}>
40 {plusIcon}
41 </span>}
42 </Wrapper>
43 );
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected