Skip to content

Commit

Permalink
Cleanup unnecessary ThemeProviders (#400)
Browse files Browse the repository at this point in the history
* Cleanup no longer needed ThemeProviders
  • Loading branch information
pdelboca authored May 24, 2024
1 parent 77da929 commit f94d64b
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 64 deletions.
10 changes: 3 additions & 7 deletions client/components/Editors/Chart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import * as themes from '../../../themes'
import * as types from '../../../types'
import Layout from './Layout'

Expand All @@ -14,10 +12,8 @@ export interface ChartProps {
export default function Chart(props: ChartProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Config/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import * as themes from '../../../themes'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import Layout from './Layout'
import * as types from '../../../types'

Expand All @@ -14,10 +12,8 @@ export interface ConfigProps {
export default function Config(props: ConfigProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Dialect/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import * as themes from '../../../themes'
import * as types from '../../../types'
import Layout from './Layout'

Expand All @@ -15,10 +13,8 @@ export interface DialectProps {
export default function Dialect(props: DialectProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Package/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import * as themes from '../../../themes'
import * as types from '../../../types'
import Layout from './Layout'

Expand All @@ -16,10 +14,8 @@ export interface PackageProps {
export default function Package(props: PackageProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Portal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import * as themes from '../../../themes'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import Layout from './Layout'
import * as types from '../../../types'

Expand All @@ -13,10 +11,8 @@ export interface PortalProps {
export default function Portal(props: PortalProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Resource/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as React from 'react'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import * as themes from '../../../themes'
import * as types from '../../../types'
import Layout from './Layout'

Expand All @@ -16,10 +14,8 @@ export interface ResourceProps {
export default function Resource(props: ResourceProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/Schema/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from 'react'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import Layout from './Layout'
import * as themes from '../../../themes'
import * as types from '../../../types'

export interface SchemaProps {
Expand All @@ -15,10 +13,8 @@ export interface SchemaProps {
export default function Schema(props: SchemaProps) {
const store = React.useMemo(() => makeStore(props), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
10 changes: 3 additions & 7 deletions client/components/Editors/View/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from 'react'
import * as themes from '../../../themes'
import { ITextEditor } from '../Text'
import { StoreProvider, makeStore } from './store'
import { ThemeProvider } from '@mui/material/styles'
import Layout from './Layout'
import * as types from '../../../types'

Expand All @@ -16,10 +14,8 @@ export default function View(props: ViewProps) {
const editorRef = React.useMemo(() => React.createRef<ITextEditor>(), [])
const store = React.useMemo(() => makeStore(props, editorRef), Object.values(props))
return (
<ThemeProvider theme={themes.DEFAULT}>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
</ThemeProvider>
<StoreProvider value={store}>
<Layout />
</StoreProvider>
)
}
12 changes: 4 additions & 8 deletions client/components/Views/Report/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import './assets/styles.css'
import Box from '@mui/material/Box'
import ReportTask from './Task'
import { ThemeProvider } from '@mui/material/styles'
import * as themes from '../../../themes'
import * as types from '../../../types'

export interface ReportProps {
Expand All @@ -12,12 +10,10 @@ export interface ReportProps {

export default function Report(props: ReportProps) {
return (
<ThemeProvider theme={themes.DEFAULT}>
<div className="frictionless-components-report">
<TopLevelErrors {...props} />
{props.shallow ? <ShallowTasks {...props} /> : <ExpandedTasks {...props} />}
</div>
</ThemeProvider>
<div className="frictionless-components-report">
<TopLevelErrors {...props} />
{props.shallow ? <ShallowTasks {...props} /> : <ExpandedTasks {...props} />}
</div>
)
}

Expand Down

0 comments on commit f94d64b

Please sign in to comment.