Skip to content

Commit

Permalink
Add vspace & update color util
Browse files Browse the repository at this point in the history
  • Loading branch information
jsloat committed Mar 7, 2024
1 parent a8eae83 commit 710b562
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/UITable/elements/VSpace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Omit_ } from '../../types/utilTypes';
import Div, { DivStyle } from './Div';
import P from './P';
import { Percent } from './types';

/** Add vertical space to a table */
export default (
height: number | Percent,
style?: Omit_<DivStyle, 'height'>
) => {
const el = Div([P('')], { height, ...style });
el.setDescription('VSPACE');
return el;
};
1 change: 1 addition & 0 deletions src/UITable/elements/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as H1 } from './H1';
export { default as H2, H2Opts } from './H2';
export { default as HR } from './HR';
export { default as HSpace } from './HSpace';
export { default as VSpace } from './VSpace';
export { default as Icon, IconOrSFKey } from './Icon';
export { default as Img } from './Img';
export { default as P } from './P';
Expand Down
1 change: 1 addition & 0 deletions src/UITable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export {
H2,
HR,
HSpace,
VSpace,
Icon,
Img,
NonCascadingDiv,
Expand Down
11 changes: 8 additions & 3 deletions src/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,16 @@ export const getDynamicColor = (
export const getColors = () =>
objectFromEntries(colorKeys.map(key => [key, getColor(key)]));

export const getEnhancedColor = (key: ColorKey): EnhancedColor => {
const val = getKeyVal(key);
export const getEnhancedColor = (
keyOrColor: ColorKey | Color
): EnhancedColor => {
const val = isString(keyOrColor) ? getKeyVal(keyOrColor) : keyOrColor;
return isEnhancedColor(val)
? val
: new EnhancedColor({ label: key, staticColor: val });
: new EnhancedColor({
label: isString(keyOrColor) ? keyOrColor : UUID.string(),
staticColor: val,
});
};

export const getDomainColor = (domain: Domain) =>
Expand Down

0 comments on commit 710b562

Please sign in to comment.