mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 12:25:22 +02:00
fix(UI): some minor fixes [EE-6667] (#11062)
Some checks failed
/ triage (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Some checks failed
/ triage (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
* minor tweeks for kubernetes settings * address review comments
This commit is contained in:
parent
b0564b9238
commit
d601d8eb7b
10 changed files with 36 additions and 15 deletions
|
@ -2,19 +2,23 @@ import { createContext, PropsWithChildren, useContext } from 'react';
|
|||
|
||||
const Context = createContext<null | boolean>(null);
|
||||
Context.displayName = 'WidgetContext';
|
||||
|
||||
export function useWidgetContext() {
|
||||
const context = useContext(Context);
|
||||
|
||||
if (context == null) {
|
||||
throw new Error('Should be inside a Widget component');
|
||||
}
|
||||
}
|
||||
|
||||
export function Widget({ children }: PropsWithChildren<unknown>) {
|
||||
export function Widget({
|
||||
children,
|
||||
id,
|
||||
}: PropsWithChildren<{
|
||||
id?: string;
|
||||
}>) {
|
||||
return (
|
||||
<Context.Provider value>
|
||||
<div className="widget">{children}</div>
|
||||
<div id={id} className="widget">
|
||||
{children}
|
||||
</div>
|
||||
</Context.Provider>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue