@@ -14,6 +14,7 @@ import Page from '../Page/Page';
1414import Leaderboard from '../leaderboard/Leaderboard' ;
1515import { languagesList } from '../../assets/languages' ;
1616import { XIcon } from '@heroicons/react/outline' ;
17+ import useDarkMode from '../../hooks/darkmode' ;
1718
1819function classNames ( ...classes : string [ ] ) {
1920 return classes . filter ( Boolean ) . join ( ' ' ) ;
@@ -30,10 +31,13 @@ const BenchmarkDetail = ({
3031} : RouteComponentProps < BenchmarkDetailParams > ) => {
3132 const [ selected , setSelected ] = useState ( languages [ 0 ] ) ;
3233 const [ open , setOpen ] = useState ( false ) ;
34+ const [ colorTheme ] = useDarkMode ( ) ;
3335
3436 //Get monaco instance to access code later
3537 const editorRef : any = useRef < null > ( null ) ;
3638
39+ let editorTheme = colorTheme === 'dark' ? 'light' : 'vs-dark' ;
40+
3741 function handleEditorDidMount ( editor : any , monaco : any ) {
3842 editorRef . current = editor ;
3943 }
@@ -185,16 +189,16 @@ const BenchmarkDetail = ({
185189 < div className = "grid w-2/5" >
186190 < div className = "pl-8 pr-8 border-4 border-dashed border-gray-200 rounded-lg h-96 p-4" >
187191 < div className = "flex justify-between" >
188- < h1 className = "text-2xl pb-3" > Subject</ h1 >
192+ < h1 className = "text-2xl pb-3 dark:text-white " > Subject</ h1 >
189193 < div className = "" >
190194 < Listbox value = { selected } onChange = { setSelected } >
191195 { ( { open } ) => (
192196 < >
193- < Listbox . Label className = "block text-sm font-medium text-gray-700" >
197+ < Listbox . Label className = "block dark:text-white text-sm font-medium text-gray-700" >
194198 Languages
195199 </ Listbox . Label >
196200 < div className = "mt-1 relative" >
197- < Listbox . Button className = "relative w-full bg-white border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
201+ < Listbox . Button className = "dark:text-white dark:bg-gray-800 relative w-full bg-white border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
198202 < span className = "flex items-center" >
199203 < img
200204 src = { selected . avatar }
@@ -222,7 +226,7 @@ const BenchmarkDetail = ({
222226 >
223227 < Listbox . Options
224228 static
225- className = "absolute z-10 mt-1 w-full bg-white shadow-lg max-h-96 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
229+ className = "dark:text-white dark:bg-gray-800 absolute z-10 mt-1 w-full bg-white shadow-lg max-h-96 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
226230 >
227231 { languages . map ( ( language ) => (
228232 < Listbox . Option
@@ -231,7 +235,7 @@ const BenchmarkDetail = ({
231235 classNames (
232236 active
233237 ? 'text-white bg-indigo-600'
234- : 'text-gray-900' ,
238+ : 'text-gray-900 dark:text-white ' ,
235239 'cursor-default select-none relative py-2 pl-3 pr-9' ,
236240 )
237241 }
@@ -262,7 +266,7 @@ const BenchmarkDetail = ({
262266 className = { classNames (
263267 active
264268 ? 'text-white'
265- : 'text-indigo-600' ,
269+ : 'text-indigo-600 dark:text-white ' ,
266270 'absolute inset-y-0 right-0 flex items-center pr-4' ,
267271 ) }
268272 >
@@ -284,7 +288,9 @@ const BenchmarkDetail = ({
284288 </ Listbox >
285289 </ div >
286290 </ div >
287- < ReactMarkdown > { benchmarkData ?. subject || '' } </ ReactMarkdown >
291+ < ReactMarkdown className = "dark:text-white" >
292+ { benchmarkData ?. subject || '' }
293+ </ ReactMarkdown >
288294 < div className = "flex" >
289295 < button
290296 className = "bg-blue-500 hover:bg-blue-700 text-white font-bold mt-2 py-2 px-4 rounded-full"
@@ -300,6 +306,7 @@ const BenchmarkDetail = ({
300306 < Editor
301307 onMount = { handleEditorDidMount }
302308 height = "100%"
309+ theme = { editorTheme }
303310 value = { lastSubmission && lastSubmission }
304311 language = { selected . name }
305312 />
0 commit comments