11import PrettyCounter from "@/components/ui/pretty-counter/PrettyCounter" ;
2- import SyntaxStrip , {
3- SyntaxStripSize ,
4- } from "@/components/ui/syntax/SyntaxStrip" ;
2+ import { SyntaxStripSize } from "@/components/ui/syntax/SyntaxStrip" ;
53import DocumentDescription from "@/components/ui/title/DocumentDescription" ;
64import DocumentTitle from "@/components/ui/title/DocumentTitle" ;
75import { useLeaderboardMetadataByIdQuery } from "@/lib/api/queries/leaderboard" ;
86import useCountdown from "@/lib/hooks/useCountdown" ;
97import { Center , Title , Skeleton , Button , Box } from "@mantine/core" ;
108import { useEffect } from "react" ;
119import { Link } from "react-router-dom" ;
10+ import ShikiHighlighter from "react-shiki" ;
1211
1312type LeaderboardWithIdMetadataOptions = {
1413 showClock ?: boolean ;
@@ -19,7 +18,17 @@ type LeaderboardWithIdMetadataOptions = {
1918export default function LeaderboardMetadataWithId (
2019 props : LeaderboardWithIdMetadataOptions ,
2120) {
22- const { showClock = false , leaderboardId, syntaxStripSize } = props ;
21+ const fontSize = ( ( ) => {
22+ switch ( props . syntaxStripSize ) {
23+ case "sm" :
24+ return "0.62em" ;
25+ case "md" :
26+ return "0.72em" ;
27+ case "lg" :
28+ return "0.85em" ;
29+ }
30+ } ) ( ) ;
31+ const { showClock = false , leaderboardId } = props ;
2332
2433 const { data, status } = useLeaderboardMetadataByIdQuery ( leaderboardId ) ;
2534 const [ countdown , reset ] = useCountdown ( - 10 ) ;
@@ -93,11 +102,16 @@ export default function LeaderboardMetadataWithId(
93102 />
94103 < Title order = { 4 } ta = { "center" } mb = { "xs" } >
95104 { leaderboardData . syntaxHighlightingLanguage ?
96- < SyntaxStrip
97- size = { syntaxStripSize }
98- name = { leaderboardData . name }
105+ < ShikiHighlighter
99106 language = { leaderboardData . syntaxHighlightingLanguage }
100- />
107+ theme = "github-dark-dimmed"
108+ showLanguage = { false }
109+ structure = "inline"
110+ as = "span"
111+ style = { { fontSize } }
112+ >
113+ { leaderboardData . name }
114+ </ ShikiHighlighter >
101115 : leaderboardData . name }
102116 </ Title >
103117 < Title order = { 6 } ta = { "center" } mb = { "xs" } >
0 commit comments