Skip to content

Commit

Permalink
Added Default Values for first component in Storyboard
Browse files Browse the repository at this point in the history
I added the first default values to our component and did some troubleshooting to get the component showing up in the storyboard canvas.
  • Loading branch information
EthanD1998 committed Apr 8, 2024
1 parent 5ebeb5b commit 094e0a7
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 5 deletions.
63 changes: 58 additions & 5 deletions stories/Field-type-info.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import ValueComponent from '../packages/discvr-ui-components/field-type-info'
import {ValueComponent} from '../packages/discvr-ui-components/field-type-info'


export const fieldType = ValueComponent({filter, index, highlightedInputs, handleFilterChange, allowedGroupNames, fieldTypeInfo});
export const fieldType = ({filter, index, highlightedInputs, handleFilterChange, allowedGroupNames, fieldTypeInfo}) => {
//ValueComponent({filter, index, highlightedInputs, handleFilterChange, allowedGroupNames, fieldTypeInfo})

return (
<ValueComponent
filter={filter}
index={index}
highlightedInputs={highlightedInputs}
handleFilterChange={handleFilterChange}
allowedGroupNames={allowedGroupNames}
fieldTypeInfo={fieldTypeInfo}
/>
);
};

fieldType.PropTypes = {

Expand All @@ -27,7 +40,7 @@ fieldType.PropTypes = {

allowedGroupNames: PropTypes.any,

fieldTypeInfo: PropTypes.shape(
fieldTypeInfo: PropTypes.arrayOf(PropTypes.shape(
{
name: PropTypes.string,
label: PropTypes.string,
Expand All @@ -45,13 +58,53 @@ fieldType.PropTypes = {
flex: PropTypes.number,
supportsFilter: PropTypes.bool
}
)
))
};

fieldType.defaultProps = {
filter: {
field: '',
operator: '',
value: ''
}
},
index: 0,
highlightedInputs: [{field:false, operator:false, value:false},{field:false, operator:false, value:false}],
handleFilterChange: (_index, _key, _value) => ({ field: "", operator: "", value: "" }),
allowedGroupNames: null,
fieldTypeInfo: [{
name: '',
label: '',
description: '',
type: '',
isInDefaultColumns: false,
isMultiValued: false,
isHidden: false,
colWidth: 0,
formatString: '',
orderKey: 0,
allowableValues: [],
category: '',
url: '',
flex: 0,
supportsFilter: false
},
{
name: '',
label: '',
description: '',
type: '',
isInDefaultColumns: false,
isMultiValued: false,
isHidden: false,
colWidth: 0,
formatString: '',
orderKey: 0,
allowableValues: [],
category: '',
url: '',
flex: 0,
supportsFilter: false
}]


}
21 changes: 21 additions & 0 deletions stories/Field-type-info.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { fn } from '@storybook/test';
import { fieldType } from './Field-type-info';

export default {
title: 'Field-type-info',
component: fieldType,
parameters: {
layout: 'centered'
},
tags: ['autodocs'],
argTypes: {

},
args: { handleFilterChange: fn() },
};

export const Primary = {
args: {

},
};

0 comments on commit 094e0a7

Please sign in to comment.