Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/__stories__/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// NOTE: The ordering of these imports determines the ordering in Storybook
import './JsonSchemaViewer';
import './SchemaRow';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import './SchemaRow';

we probably no longer need it do we?

Copy link
Contributor

@paulatulis paulatulis Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgreen44 was trying to review this but storybook will not start for me. Can you please make a follow up PR and remove this? TY!

Screen Shot 2021-11-24 at 3 18 04 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulatulis : I'm sorry, I'm not sure I understand what you mean by "make a follow up PR and remove this"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you import SchemaRow into this file, but I believe it needs to be removed per @P0lip 's suggested change above. When you check out the main branch and try running yarn storybook, are you able to get it started? Maybe it's just me?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storybook has been removed. I will make another PR to remove ./SchemaRow import

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I believe she is referring to the line removal suggestion Jakub made)

4 changes: 1 addition & 3 deletions src/components/SchemaRow/SchemaRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export interface SchemaRowProps {
}

export const SchemaRow: React.FunctionComponent<SchemaRowProps> = ({ schemaNode, nestingLevel }) => {
const description = isRegularNode(schemaNode) ? schemaNode.annotations.description : null;

const { defaultExpandedDepth, renderRowAddon, onGoToRef, hideExamples } = useJSVOptionsContext();

const [isExpanded, setExpanded] = React.useState<boolean>(
Expand All @@ -35,6 +33,7 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = ({ schemaNode,

const { selectedChoice, setSelectedChoice, choices } = useChoices(schemaNode);
const typeToShow = selectedChoice.type;
const description = isRegularNode(typeToShow) ? typeToShow.annotations.description : null;

const refNode = React.useMemo<ReferenceNode | null>(() => {
if (isReferenceNode(schemaNode)) {
Expand Down Expand Up @@ -119,7 +118,6 @@ export const SchemaRow: React.FunctionComponent<SchemaRowProps> = ({ schemaNode,
validations={isRegularNode(schemaNode) ? schemaNode.validations : {}}
/>
</div>

{typeof description === 'string' && description.length > 0 && (
<div className="sl-flex sl-flex-1 sl-my-2 sl-text-base">
<Description value={description} />
Expand Down