Skip to content

Commit

Permalink
feat: option to disable cell padding for each object (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Wizard committed Feb 15, 2022
1 parent 4aeaa5a commit 31d9ab8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 38 deletions.
1 change: 1 addition & 0 deletions apis/nucleus/src/__tests__/nucleus.spec.js
Expand Up @@ -93,6 +93,7 @@ describe('nucleus', () => {
context: {
constraints: {},
deviceType: 'auto',
disableCellPadding: false,
keyboardNavigation: false,
language: 'en-US',
theme: 'light',
Expand Down
3 changes: 2 additions & 1 deletion apis/nucleus/src/components/Cell.jsx
Expand Up @@ -276,6 +276,7 @@ const Cell = forwardRef(
({ halo, model, initialSnOptions, initialSnPlugins, initialError, onMount, currentId }, ref) => {
const { app, types } = halo;
const { nebbie } = halo.public;
const { disableCellPadding = false } = halo.context || {};

const { translator, language, keyboardNavigation } = useContext(InstanceContext);
const theme = useTheme();
Expand Down Expand Up @@ -493,7 +494,7 @@ const Cell = forwardRef(
position: 'relative',
width: '100%',
height: '100%',
padding: theme.spacing(1),
...(!disableCellPadding ? { padding: theme.spacing(1) } : {}),
...(state.longRunningQuery ? { opacity: '0.3' } : {}),
}}
>
Expand Down
2 changes: 2 additions & 0 deletions apis/nucleus/src/index.js
Expand Up @@ -14,6 +14,7 @@ import { create as typesFn } from './sn/types';

/**
* @interface Context
* @property {boolean=} disableCellPadding
* @property {boolean=} keyboardNavigation
* @property {object=} constraints
* @property {boolean=} constraints.active
Expand All @@ -29,6 +30,7 @@ const DEFAULT_CONTEXT = /** @lends Context */ {
deviceType: 'auto',
constraints: {},
keyboardNavigation: false,
disableCellPadding: false,
};

/**
Expand Down
58 changes: 31 additions & 27 deletions apis/stardust/api-spec/spec.json
Expand Up @@ -517,6 +517,10 @@
"Context": {
"kind": "interface",
"entries": {
"disableCellPadding": {
"optional": true,
"type": "boolean"
},
"keyboardNavigation": {
"optional": true,
"type": "boolean"
Expand Down Expand Up @@ -1146,6 +1150,33 @@
}
}
},
"Plugin": {
"description": "An object literal containing meta information about the plugin and a function containing the plugin implementation.",
"stability": "experimental",
"availability": {
"since": "1.2.0"
},
"kind": "interface",
"entries": {
"info": {
"description": "Object that can hold various meta info about the plugin",
"kind": "object",
"entries": {
"name": {
"description": "The name of the plugin",
"type": "string"
}
}
},
"fn": {
"description": "The implementation of the plugin. Input and return value is up to the plugin implementation to decide based on its purpose.",
"type": "function"
}
},
"examples": [
"const plugin = {\n info: {\n name: \"example-plugin\",\n type: \"meta-type\",\n },\n fn: () => {\n // Plugin implementation goes here\n }\n};"
]
},
"Field": {
"kind": "alias",
"items": {
Expand Down Expand Up @@ -1255,33 +1286,6 @@
}
}
},
"Plugin": {
"description": "An object literal containing meta information about the plugin and a function containing the plugin implementation.",
"stability": "experimental",
"availability": {
"since": "1.2.0"
},
"kind": "interface",
"entries": {
"info": {
"description": "Object that can hold various meta info about the plugin",
"kind": "object",
"entries": {
"name": {
"description": "The name of the plugin",
"type": "string"
}
}
},
"fn": {
"description": "The implementation of the plugin. Input and return value is up to the plugin implementation to decide based on its purpose.",
"type": "function"
}
},
"examples": [
"const plugin = {\n info: {\n name: \"example-plugin\",\n type: \"meta-type\",\n },\n fn: () => {\n // Plugin implementation goes here\n }\n};"
]
},
"LoadType": {
"kind": "interface",
"params": [
Expand Down
21 changes: 11 additions & 10 deletions apis/stardust/types/index.d.ts
Expand Up @@ -171,6 +171,7 @@ export function useKeyboard(): stardust.Keyboard;

declare namespace stardust {
interface Context {
disableCellPadding?: boolean;
keyboardNavigation?: boolean;
constraints?: {
active?: boolean;
Expand Down Expand Up @@ -363,6 +364,16 @@ declare namespace stardust {

}

/**
* An object literal containing meta information about the plugin and a function containing the plugin implementation.
*/
interface Plugin {
info: {
name: string;
};
fn: ()=>void;
}

type Field = string | EngineAPI.INxDimension | EngineAPI.INxMeasure | stardust.LibraryField;

/**
Expand Down Expand Up @@ -396,16 +407,6 @@ declare namespace stardust {
type: "dimension" | "measure";
}

/**
* An object literal containing meta information about the plugin and a function containing the plugin implementation.
*/
interface Plugin {
info: {
name: string;
};
fn: ()=>void;
}

interface LoadType {
(type: {
name: string;
Expand Down

0 comments on commit 31d9ab8

Please sign in to comment.