1
- import React , { FC , useState } from 'react'
1
+ import React , { createContext , FC , useState } from 'react'
2
2
import PropTypes from 'prop-types'
3
3
import { graphql } from 'gatsby'
4
4
import { MDXProvider } from '@mdx-js/react'
5
5
import { MDXRenderer } from 'gatsby-plugin-mdx'
6
6
import { Ads , CodeBlock , Example , Footer , Header , Seo , Sidebar , Toc } from './../components/'
7
- import { CCol , CContainer , CLink , CRow , CTable } from '@coreui/react/src/ '
7
+ import { CCol , CContainer , CLink , CRow , CTable } from '@coreui/react'
8
8
import './../styles/styles.scss'
9
9
10
- interface ContextProps {
11
- sidebarVisible : boolean | undefined
12
- setSidebarVisible : React . Dispatch < React . SetStateAction < boolean | undefined > >
13
- }
10
+ import { AppContext } from './../AppContext'
11
+
12
+ // interface ContextProps {
13
+ // name?: string
14
+ // sidebarVisible: boolean | undefined
15
+ // setSidebarVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>
16
+ // }
14
17
15
- export const myContext = React . createContext ( { } as ContextProps )
18
+ // export const MyContext = createContext({
19
+ // name: 'DocsContext',
20
+ // } as ContextProps)
16
21
17
22
const components = {
18
23
// eslint-disable-next-line react/display-name
@@ -22,78 +27,74 @@ const components = {
22
27
Example,
23
28
}
24
29
25
- const DocsLayout : FC = ( { data : { mdx } } ) => {
26
- // const myMarkdownFile = require('@coreui/coreui/scss/_variables.scss').toString()
30
+ const DocsLayout : FC = ( { data : { mdx } } : { data : any } ) => {
27
31
const [ sidebarVisible , setSidebarVisible ] = useState ( )
28
32
return (
29
- < >
33
+ < AppContext . Provider
34
+ value = { {
35
+ name : 'aaaaa' ,
36
+ sidebarVisible,
37
+ setSidebarVisible,
38
+ } }
39
+ >
30
40
< Seo
31
41
title = { mdx . frontmatter . title }
32
42
description = { mdx . frontmatter . description }
33
43
name = { mdx . frontmatter . name }
34
44
/>
35
- < myContext . Provider
36
- value = { {
37
- sidebarVisible,
38
- setSidebarVisible,
39
- } }
40
- >
41
- < Sidebar currentRoute = { mdx . frontmatter . route } />
42
- < div className = "wrapper d-flex flex-column min-vh-100" >
43
- < Header />
44
- < div className = "body flex-grow-1 px-3" >
45
- < CContainer lg >
46
- < CRow >
47
- < CCol lg = { 9 } >
48
- < div className = "bg-info bg-opacity-10 border-start border-start-5 border-start-info p-4 pb-3 mb-5" >
49
- < h3 className = "mb-4" > Support CoreUI Development</ h3 >
50
- < p >
51
- CoreUI is an MIT-licensed open source project and is completely free to use.
52
- However, the amount of effort needed to maintain and develop new features for
53
- the project is not sustainable without proper financial backing.
54
- </ p >
55
- < p >
56
- You can support our Open Source software development in the following ways:
57
- </ p >
58
- < ul >
59
- < li >
60
- Buy the{ ' ' }
61
- < CLink href = "https://coreui.io/pricing/?support=react" > CoreUI PRO</ CLink > ,
62
- and get access to PRO components, and dedicated support.
63
- </ li >
64
- < li >
65
- < CLink href = "https://opencollective.com/coreui" target = "_blank" >
66
- Became a sponsor
67
- </ CLink >
68
- , and get your logo on BACKERS.md/README.md files or each site of this
69
- documentation
70
- </ li >
71
- < li >
72
- Give us a star ⭐️ on{ ' ' }
73
- < CLink href = "https://github.com/coreui/coreui-react" target = "_blank" >
74
- Github
75
- </ CLink >
76
- .
77
- </ li >
78
- </ ul >
79
- </ div >
80
- < h1 > { mdx . frontmatter . title } </ h1 >
81
- < p className = "docs-lead fs-4 fw-light" > { mdx . frontmatter . description } </ p >
82
- < Ads code = "CEAICKJY" placement = "coreuiio" />
83
- < MDXProvider components = { components } >
84
- < MDXRenderer frontmatter = { mdx . frontmatter } > { mdx . body } </ MDXRenderer >
85
- </ MDXProvider >
86
- </ CCol >
87
- < CCol lg = { 3 } >
88
- < Toc items = { mdx . tableOfContents } />
89
- </ CCol >
90
- </ CRow >
91
- </ CContainer >
92
- </ div >
93
- < Footer />
45
+ < Sidebar currentRoute = { mdx . frontmatter . route } />
46
+ < div className = "wrapper d-flex flex-column min-vh-100" >
47
+ < Header />
48
+ < div className = "body flex-grow-1 px-3" >
49
+ < CContainer lg >
50
+ < CRow >
51
+ < CCol lg = { 9 } >
52
+ < div className = "bg-info bg-opacity-10 border-start border-start-5 border-start-info p-4 pb-3 mb-5" >
53
+ < h3 className = "mb-4" > Support CoreUI Development</ h3 >
54
+ < p >
55
+ CoreUI is an MIT-licensed open source project and is completely free to use.
56
+ However, the amount of effort needed to maintain and develop new features for
57
+ the project is not sustainable without proper financial backing.
58
+ </ p >
59
+ < p > You can support our Open Source software development in the following ways:</ p >
60
+ < ul >
61
+ < li >
62
+ Buy the{ ' ' }
63
+ < CLink href = "https://coreui.io/pricing/?support=react" > CoreUI PRO</ CLink > , and
64
+ get access to PRO components, and dedicated support.
65
+ </ li >
66
+ < li >
67
+ < CLink href = "https://opencollective.com/coreui" target = "_blank" >
68
+ Became a sponsor
69
+ </ CLink >
70
+ , and get your logo on BACKERS.md/README.md files or each site of this
71
+ documentation
72
+ </ li >
73
+ < li >
74
+ Give us a star ⭐️ on{ ' ' }
75
+ < CLink href = "https://github.com/coreui/coreui-react" target = "_blank" >
76
+ Github
77
+ </ CLink >
78
+ .
79
+ </ li >
80
+ </ ul >
81
+ </ div >
82
+ < h1 > { mdx . frontmatter . title } </ h1 >
83
+ < p className = "docs-lead fs-4 fw-light" > { mdx . frontmatter . description } </ p >
84
+ < Ads code = "CEAICKJY" placement = "coreuiio" />
85
+ < MDXProvider components = { components } >
86
+ < MDXRenderer frontmatter = { mdx . frontmatter } > { mdx . body } </ MDXRenderer >
87
+ </ MDXProvider >
88
+ </ CCol >
89
+ < CCol lg = { 3 } >
90
+ < Toc items = { mdx . tableOfContents } />
91
+ </ CCol >
92
+ </ CRow >
93
+ </ CContainer >
94
94
</ div >
95
- </ myContext . Provider >
96
- </ >
95
+ < Footer />
96
+ </ div >
97
+ </ AppContext . Provider >
97
98
)
98
99
}
99
100
0 commit comments