Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/react/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
WorkbookElementData,
WorkbookSelection,
WorkbookVariable,
PluginStyle,
} from '../types';
import { deepEqual } from '../utils/deepEqual';

Expand Down Expand Up @@ -246,3 +247,15 @@ export function useActionEffect(configId: string, effect: () => void) {
return client.config.registerEffect(configId, effectRef.current);
}, [client, configId, effect]);
}

/**
* React hook for accessing plugin style properties
* @returns {PluginStyle} Style properties
*/
export function usePluginStyle(): PluginStyle {
const client = useConfig();
Comment thread
alisonjlai marked this conversation as resolved.
Outdated

return {
backgroundColor: client?.backgroundColor,
};
}
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ export type ScalarType = 'boolean' | 'datetime' | 'number' | 'integer' | 'text';
export type PrimitiveType = ScalarType | 'variant' | 'link';
export type ValueType = PrimitiveType | 'error';

/**
* Style properties that can be configured through the plugin format panel
*/
export interface PluginStyle {
backgroundColor?: string;
}

/**
* All mutable workbook control variable types
*/
Expand Down