mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(ui): remove global providers [EE-4128] (#7578)
This commit is contained in:
parent
d3f094cb18
commit
fad376b415
46 changed files with 372 additions and 214 deletions
|
@ -4,6 +4,7 @@ import clsx from 'clsx';
|
|||
import styles from './HeaderContainer.module.css';
|
||||
|
||||
const Context = createContext<null | boolean>(null);
|
||||
Context.displayName = 'PageHeaderContext';
|
||||
|
||||
export function useHeaderContext() {
|
||||
const context = useContext(Context);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { createContext, PropsWithChildren, useContext } from 'react';
|
||||
|
||||
const Context = createContext<null | boolean>(null);
|
||||
Context.displayName = 'WidgetContext';
|
||||
|
||||
export function useWidgetContext() {
|
||||
const context = useContext(Context);
|
||||
|
|
|
@ -2,6 +2,7 @@ import { createContext, PropsWithChildren, useContext } from 'react';
|
|||
|
||||
export function createRowContext<TContext>() {
|
||||
const Context = createContext<TContext | null>(null);
|
||||
Context.displayName = 'RowContext';
|
||||
|
||||
return { RowProvider, useRowContext };
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ interface TableSettingsContextInterface<T> {
|
|||
const TableSettingsContext = createContext<TableSettingsContextInterface<
|
||||
Record<string, unknown>
|
||||
> | null>(null);
|
||||
TableSettingsContext.displayName = 'TableSettingsContext';
|
||||
|
||||
export function useTableSettings<T>() {
|
||||
const Context = getContextType<T>();
|
||||
|
|
|
@ -7,6 +7,7 @@ interface TableSettingsContextInterface<T> {
|
|||
const TableSettingsContext = createContext<TableSettingsContextInterface<
|
||||
Record<string, unknown>
|
||||
> | null>(null);
|
||||
TableSettingsContext.displayName = 'TableSettingsContext';
|
||||
|
||||
export function useTableSettings<T>() {
|
||||
const Context = getContextType<T>();
|
||||
|
|
|
@ -2,6 +2,7 @@ import clsx from 'clsx';
|
|||
import { createContext, PropsWithChildren, useContext } from 'react';
|
||||
|
||||
const Context = createContext<null | boolean>(null);
|
||||
Context.displayName = 'InputGroupContext';
|
||||
|
||||
type Size = 'small' | 'large';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue