Skip to content

Commit

Permalink
feat: allow to create a Footer for AdminJS app
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Dec 4, 2023
1 parent c907f14 commit 528b78b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/backend/utils/component-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,6 @@ export class ComponentLoader {
'PropertyLabel',
'Login',
'AuthenticationBackgroundComponent',
'Footer',
]
}
3 changes: 2 additions & 1 deletion src/frontend/bundle-entry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ViewHelpers from '../backend/utils/view-helpers/view-helpers.js'
import { flat } from '../utils/flat/index.js'
import * as AppComponents from './components/app/index.js'
import * as ActionComponents from './components/actions/index.js'
import App from './components/application.js'
import App, { OriginalApp } from './components/application.js'
import { AppLoader } from './components/index.js'
import Login from './components/login/index.js'
import BasePropertyComponent, { CleanPropertyComponent } from './components/property-type/index.js'
Expand Down Expand Up @@ -62,6 +62,7 @@ window.regeneratorRuntime = regeneratorRuntime
export default {
withNotice,
Application,
OriginalApplication: OriginalApp,
LoginApplication,
ViewHelpers,
UserComponents: {},
Expand Down
13 changes: 13 additions & 0 deletions src/frontend/components/app/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'

import allowOverride from '../../hoc/allow-override.js'

const Footer: React.FC = () => null

const OverridableFooter = allowOverride(Footer, 'Footer')

export {
OverridableFooter as default,
OverridableFooter as Footer,
Footer as OriginalFooter,
}
1 change: 1 addition & 0 deletions src/frontend/components/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export * from './sort-link.js'
export { default as SortLink } from './sort-link.js'
export * from './top-bar.js'
export * from './version.js'
export * from './footer.js'
2 changes: 2 additions & 0 deletions src/frontend/components/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from './routes/index.js'
import useHistoryListen from '../hooks/use-history-listen.js'
import { AuthenticationBackgroundComponent } from './app/auth-background-component.js'
import { Footer } from './app/footer.js'

const h = new ViewHelpers()

Expand Down Expand Up @@ -82,6 +83,7 @@ const App: React.FC = () => {
</Route>
<Route path="*" element={<DashboardRoute />} />
</Routes>
<Footer />
</Box>
<Modal />
<AuthenticationBackgroundComponent />
Expand Down
1 change: 1 addition & 0 deletions src/frontend/utils/overridable-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export type OverridableComponent =
| 'PropertyLabel'
| 'Login'
| 'AuthenticationBackgroundComponent'
| 'Footer'

/**
* Name of the components which can be overridden by ComponentLoader.
Expand Down

0 comments on commit 528b78b

Please sign in to comment.