Merge pull request #1457 from yashsinghcodes/origin/docs-blockquotes

[feature]: tip section support for docs
This commit is contained in:
Frikky
2024-07-31 19:33:13 +02:00
committed by GitHub
+33 -1
View File
@@ -122,7 +122,7 @@ export const Paragrah = (props) => {
return ( return (
<div class="sdf"> <div>
{element} {element}
</div> </div>
) )
@@ -457,6 +457,30 @@ const Docs = (defaultprops) => {
minHeight: "80vh", minHeight: "80vh",
}; };
const noteLabelStyle = {
fontWeight: "bold",
color: "#f86a3e",
display: "block",
marginBottom: "5px",
};
const Blockquote = ({ children }) => {
const textContent = children.map(child =>
child.props && child.props.children ? child.props.children.join('') : child
).join('').trim();
// Maybe some more contents....
const isNote = textContent.startsWith("[!TIP]");
return (
<blockquote style={isNote ? alertNote : {}}>
{isNote && <span style={noteLabelStyle}>Tips:</span>}
{isNote ? textContent.replace("[!TIP]", "").trim() : children}
</blockquote>
);
};
const Heading = (props) => { const Heading = (props) => {
const [hover, setHover] = useState(false); const [hover, setHover] = useState(false);
var id = props.children[0].toLowerCase().toString() var id = props.children[0].toLowerCase().toString()
@@ -840,6 +864,12 @@ const Docs = (defaultprops) => {
fontSize: isMobile ? "1.3rem" : "1.1rem", fontSize: isMobile ? "1.3rem" : "1.1rem",
}; };
const alertNote = {
padding: "10px",
borderLeft: "5px solid #f86a3e",
backgroundColor: "rgb(26,26,26)",
};
const CustomButton = (props) => { const CustomButton = (props) => {
const { title, icon, link } = props const { title, icon, link } = props
@@ -974,9 +1004,11 @@ const Docs = (defaultprops) => {
h6: Heading, h6: Heading,
a: OuterLink, a: OuterLink,
p: Paragrah, p: Paragrah,
blockquote: Blockquote,
} }
// PostDataBrowser Section // PostDataBrowser Section
const postDataBrowser = const postDataBrowser =
list === undefined || list === null ? null : ( list === undefined || list === null ? null : (