docs: update and fix UI props docs (#10754)

This commit is contained in:
Shahed Nasser
2024-12-27 14:53:46 +02:00
committed by GitHub
parent 8839970295
commit 1c355dac36
85 changed files with 2068 additions and 324 deletions
@@ -66,7 +66,10 @@ const ComponentReference = ({
<PropTable props={componentSpec.props!} />
</Suspense>
</Container>
<Feedback title={`props of ${component}`} />
<Feedback
title={`props of ${component}`}
question="Was this helpful?"
/>
</>
)}
</>
+14 -4
View File
@@ -45,7 +45,10 @@ const Row = ({
propData: { tsType: tsType, defaultValue, description },
}: RowProps) => {
const normalizeRaw = (str: string): string => {
return str.replace("\\|", "|")
return str
.replace("\\|", "|")
.replaceAll("&#60;", "<")
.replaceAll("&#62;", ">")
}
const getTypeRaw = useCallback((type: PropSpecType): string => {
let raw = "raw" in type ? type.raw || type.name : type.name
@@ -74,9 +77,11 @@ const Row = ({
}, [])
const getTypeTooltipContent = useCallback(
(type: PropSpecType): string | undefined => {
if (type?.name === "signature" && "type" in type) {
return getTypeRaw(type)
} else if (type?.name === "Array" && type.raw) {
if (
(type?.name === "signature" && "type" in type) ||
(type?.name === "Array" && type.raw) ||
("raw" in type && type.raw)
) {
return getTypeRaw(type)
}
@@ -107,6 +112,11 @@ const Row = ({
text: element.value,
canBeCopied: true,
})
} else if ("raw" in element) {
typeNodes.push({
text: getTypeText(element),
tooltipContent: getTypeTooltipContent(element),
})
} else {
typeNodes.push({
text: element.name,