Skip to content

Commit

Permalink
fix: accept false for data:
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Feb 28, 2020
1 parent d1f8f85 commit 1ec10ba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions blocks/core/src/Source/Source.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ simpleSource.story = {
/>
);
};`,
data: null,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion blocks/core/src/StorySource/StorySource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const StorySource: FC<StorySourceProps> = ({
if (parentTheme === undefined) {
actions.push({ title: themeName, onClick: onRotateTheme });
}
if (args) {
if (args && args.length) {
actions.push({ title: viewStyle, onClick: onMergeValues });
}

Expand Down
2 changes: 1 addition & 1 deletion core/core/src/randomizeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const randomizeData = (
.map(name => {
const control = controls[name];
const { data } = control;
if (data === null) {
if (data === false || data === null) {
return null;
}
// check if control has custom settings for generating data
Expand Down
5 changes: 3 additions & 2 deletions core/specification/src/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ export interface ComponentControlBase<T> {

/**
* helper information to generate random data
* can be used in conjunction with faker.js
* will be used in conjunction with faker.js
* datacan be set to false, if the control should not be randomized
*/
data?: ComponentControlData | null;
data?: ComponentControlData | null | false;
}

export interface ComponentControlText extends ComponentControlBase<string> {
Expand Down

0 comments on commit 1ec10ba

Please sign in to comment.