-
Notifications
You must be signed in to change notification settings - Fork 99
docs(userguide): add component support tags to feature pages #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5accb00
3433edc
023bee8
efaac30
160e16d
e667220
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import React from "react"; | ||
| import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; | ||
| import Link from "@docusaurus/Link"; | ||
| import styles from "./SupportedComponents.module.css"; | ||
|
|
||
| const TYPE_CLASSES = { | ||
| hami: styles.tagHami, | ||
| volcano: styles.tagVolcano, | ||
| "hami-dra": styles.tagHamiDra, | ||
| cdi: styles.tagCdi, | ||
| }; | ||
|
|
||
| export function Tag({ href, type, children }) { | ||
| const className = `${styles.tag} ${TYPE_CLASSES[type] || styles.tagDefault}`; | ||
| if (href) { | ||
| const to = href.replace(/\.mdx?(#.*)?$/, "$1"); | ||
| return ( | ||
| <Link to={to} className={className}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a markdown link would be checked by onBrokenLinks, but a Link to built here is not. what catches it when one of these pages moves?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI runs npm run check-links (linkinator) on every PR, which crawls all the generated HTML pages and catches any broken 404 links |
||
| {children} | ||
| </Link> | ||
| ); | ||
| } | ||
| return <span className={className}>{children}</span>; | ||
| } | ||
|
|
||
| export function Requires({ children }) { | ||
| const { i18n } = useDocusaurusContext(); | ||
| const label = i18n.currentLocale === "zh" ? "前置要求:" : "Requires:"; | ||
|
|
||
| return ( | ||
| <div className={styles.requiresContainer}> | ||
| <strong className={styles.label}>{label}</strong> | ||
| <div className={styles.tags}>{children}</div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default function SupportedComponents({ children }) { | ||
| const { i18n } = useDocusaurusContext(); | ||
| const label = i18n.currentLocale === "zh" ? "支持组件/模式:" : "Supported Components:"; | ||
|
|
||
| return ( | ||
| <div className={styles.container}> | ||
| <strong className={styles.label}>{label}</strong> | ||
| <div className={styles.tags}>{children}</div> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| .container { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| margin-bottom: 8px; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .requiresContainer { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| margin-bottom: 20px; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .label { | ||
| font-size: 0.9rem; | ||
| } | ||
|
|
||
| .tags { | ||
| display: inline-flex; | ||
| gap: 8px; | ||
| flex-wrap: wrap; | ||
| } | ||
|
|
||
| .tag { | ||
| display: inline-block; | ||
| padding: 3px 12px; | ||
| border-radius: 12px; | ||
| color: #fff !important; | ||
| font-weight: 600; | ||
| font-size: 0.82rem; | ||
| text-decoration: none !important; | ||
| transition: opacity 0.2s ease-in-out; | ||
| } | ||
|
|
||
| .tag:hover { | ||
| opacity: 0.9; | ||
| text-decoration: none !important; | ||
| } | ||
|
|
||
| .tagHami { | ||
| background-color: #065f46; | ||
| } | ||
|
|
||
| .tagVolcano { | ||
| background-color: #1e40af; | ||
| } | ||
|
|
||
| .tagHamiDra { | ||
| background-color: #5b21b6; | ||
| } | ||
|
|
||
| .tagCdi { | ||
| background-color: #075985; | ||
| } | ||
|
|
||
| .tagDefault { | ||
| background-color: #374151; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same duplicated A100-SXM4-40GB is still in the zh v2.7.0, v2.5.1, v2.5.0 and v1.3.0 pages and in zh v2.9.0 developers/dynamic-mig.md. should they change in the same pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs say older versions are frozen snapshots, so I only touched v2.9.0
and I did not touch developers/ because #794 is already editing that whole file
But if you want, I can remove this fix so #794 handles it