File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,11 @@ module.exports = {
9595 label : "Editor" ,
9696 position : "left" ,
9797 } ,
98+ {
99+ href : "/gallery" ,
100+ label : "Gallery" ,
101+ position : "left" ,
102+ } ,
98103 {
99104 href : "https://casdoor.com" ,
100105 label : "For Enterprise" ,
Original file line number Diff line number Diff line change 1+ import React , { useEffect , useState } from "react" ;
2+ import Layout from "@theme/Layout" ;
3+ import Giscus from "@giscus/react" ;
4+ import { useColorMode } from "@docusaurus/theme-common" ;
5+ import useDocusaurusContext from "@docusaurus/useDocusaurusContext" ;
6+
7+ function GalleryContent ( ) {
8+ const { colorMode} = useColorMode ( ) ;
9+ const { i18n} = useDocusaurusContext ( ) ;
10+ const currentLanguage = i18n . currentLocale ;
11+ const [ galleryUrl , setGalleryUrl ] = useState ( "" ) ;
12+
13+ useEffect ( ( ) => {
14+ setGalleryUrl ( `https://editor.casbin.org/gallery?theme=${ colorMode } &lang=${ currentLanguage } ` ) ;
15+ } , [ colorMode , currentLanguage ] ) ;
16+
17+ return (
18+ < >
19+ < div className = "editor-container" >
20+ < iframe
21+ src = { galleryUrl }
22+ className = "editor-iframe"
23+ title = "Casbin-gallery"
24+ />
25+ </ div >
26+ < div className = "comments-container" >
27+ < Giscus
28+ id = "comments"
29+ repo = "casbin/casbin"
30+ repoId = "MDEwOlJlcG9zaXRvcnk4NzYxNzUwOA=="
31+ category = "Docs comments"
32+ categoryId = "DIC_kwDOBTjv5M4CRIiA"
33+ mapping = "pathname"
34+ strict = "0"
35+ reactionsEnabled = "1"
36+ emitMetadata = "0"
37+ inputPosition = "top"
38+ theme = { colorMode }
39+ lang = { currentLanguage }
40+ loading = "lazy"
41+ />
42+ </ div >
43+ </ >
44+ ) ;
45+ }
46+
47+ function Gallery ( ) {
48+ return (
49+ < Layout
50+ title = "Gallery"
51+ description = "Casbin Online Gallery"
52+ >
53+ < GalleryContent />
54+ </ Layout >
55+ ) ;
56+ }
57+
58+ export default Gallery ;
You can’t perform that action at this time.
0 commit comments