File tree Expand file tree Collapse file tree 5 files changed +27
-14
lines changed
Expand file tree Collapse file tree 5 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 1- import React , { type JSX } from "react" ;
1+ import React , { type JSX , type ReactNode } from "react" ;
22import Link from "@docusaurus/Link" ;
33
4- export default function RemixEmbed ( { children, fileName } ) : JSX . Element {
4+ type RemixEmbedProps = {
5+ children : ReactNode ;
6+ fileName : string ;
7+ } ;
8+
9+ const sanitizeFileName = ( value : string ) =>
10+ encodeURIComponent ( value ) . replace ( / % 2 F / g, "/" ) ;
11+
12+ export default function RemixEmbed ( {
13+ children,
14+ fileName,
15+ } : RemixEmbedProps ) : JSX . Element {
516 const baseUrl = "https://remix.ethereum.org/" ;
617 const githubUrl =
718 "#url=https://github.com/flare-foundation/developer-hub/blob/main/examples/developer-hub-solidity/" +
8- fileName ;
19+ sanitizeFileName ( fileName ) ;
920 const parameters =
1021 "&version=builtin&evmVersion=cancun&optimize=true&runs=200" ;
1122 return (
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ const YouTubeEmbed: React.FC<YouTubeEmbedProps> = ({
6060 useEffect ( ( ) => {
6161 if ( isActivated ) return ;
6262 if ( loadStrategy !== "onVisible" ) return ;
63+ if ( typeof IntersectionObserver === "undefined" ) {
64+ setIsActivated ( true ) ;
65+ return ;
66+ }
6367
6468 const el = containerRef . current ;
6569 if ( ! el ) return ;
Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ const CATEGORY_ORDER = [
4545 "Explorers" ,
4646] as const ;
4747
48+ const slugifyCategory = ( value : string ) =>
49+ value
50+ . toLowerCase ( )
51+ . trim ( )
52+ . replace ( / [ ^ a - z 0 - 9 ] + / g, "-" )
53+ . replace ( / ^ - + | - + $ / g, "" ) || "category" ;
54+
4855function scrollToHash ( hash : string ) {
4956 const id = hash . replace ( / ^ # / , "" ) ;
5057 if ( ! id ) return ;
@@ -186,7 +193,7 @@ const DeveloperTools: React.FC = () => {
186193 </ div >
187194
188195 { orderedCategories . map ( ( [ category , tools ] ) => {
189- const categoryId = CATEGORY_IDS [ category ] ?? category ;
196+ const categoryId = CATEGORY_IDS [ category ] ?? slugifyCategory ( category ) ;
190197
191198 return (
192199 < div key = { category } className = { styles . categorySection } >
Original file line number Diff line number Diff line change 66 findFirstSidebarItemLink ,
77} from "@docusaurus/plugin-content-docs/client" ;
88import { usePluralForm } from "@docusaurus/theme-common" ;
9- import isInternalUrl from "@docusaurus/isInternalUrl" ;
109import { translate } from "@docusaurus/Translate" ;
1110
1211import type { Props } from "@theme/DocCard" ;
@@ -54,12 +53,10 @@ function CardContainer({
5453
5554function CardLayout ( {
5655 href,
57- // icon,
5856 title,
5957 description,
6058} : {
6159 href : string ;
62- // icon?: ReactNode;
6360 title : string ;
6461 description ?: string ;
6562} ) : JSX . Element {
@@ -71,7 +68,6 @@ function CardLayout({
7168 className = { clsx ( "text--truncate" , styles . cardTitle ) }
7269 title = { title }
7370 >
74- { /* {icon} */ }
7571 { title }
7672 </ Heading >
7773 < svg
@@ -115,22 +111,17 @@ function CardCategory({
115111 return (
116112 < CardLayout
117113 href = { href }
118- // @ts -expect-error: To make linter happy not sure whats wrong since code is swizzled from docosaurus theme
119- icon = "🗃️"
120114 title = { item . label }
121115 description = { item . description ?? categoryItemsPlural ( item . items . length ) }
122116 />
123117 ) ;
124118}
125119
126120function CardLink ( { item } : { item : PropSidebarItemLink } ) : JSX . Element {
127- const icon = isInternalUrl ( item . href ) ? "📄️" : "🔗" ;
128121 const doc = useDocById ( item . docId ?? undefined ) ;
129122 return (
130123 < CardLayout
131124 href = { item . href }
132- // @ts -expect-error: To make linter happy not sure whats wrong since code is swizzled from docosaurus theme
133- icon = { icon }
134125 title = { item . label }
135126 description = { item . description ?? doc ?. description }
136127 />
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default function PaginatorNavLink(props: Props): JSX.Element {
1818 < div
1919 className = { clsx (
2020 styles . subLabel ,
21- isNext ? styles . nextSubLabel : styles . prevSubLabe ,
21+ isNext ? styles . nextSubLabel : styles . prevSubLabel ,
2222 ) }
2323 >
2424 { ! isNext && (
You can’t perform that action at this time.
0 commit comments