question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Addon-docs: Doesn't render values within objects

See original GitHub issue

Describe the bug

This is my code:

GridContainer.tsx

import React, { ReactNode } from 'react';

import { grid } from './variables';

import { Container } from './Grid.styles';

interface GridContainerProps {
  children: ReactNode;
  columns?: number;
  gutter?: number;
}

const GridContainer = ({ children, columns, gutter }: GridContainerProps) => {
  return (
    <Container columns={columns} gutter={gutter}>
      {children}
    </Container>
  );
};

GridContainer.defaultProps = {
  columns: grid.numberOfColumns,
  gutter: grid.gutter,
};

export default GridContainer;

variables.ts

const grid = {
  numberOfColumns: 12,
  gutter: 24,
};
...

export { grid, .... };

And this is the generated doc table

image

Expected behavior Print grid object value in the “default” column

System: OS: macOS 10.15.4 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Binaries: Node: 12.18.1 - ~/.asdf/installs/nodejs/12.18.1/bin/node Yarn: 1.22.4 - ~/.asdf/installs/nodejs/12.18.1/.npm/bin/yarn Browsers: Chrome: 83.0.4103.116 npmPackages: @storybook/addon-actions: 5.3.19 => 5.3.19 @storybook/addon-docs: 5.3.19 => 5.3.19 @storybook/addon-knobs: 5.3.19 => 5.3.19 @storybook/addon-links: 5.3.19 => 5.3.19 @storybook/addon-storysource: 5.3.19 => 5.3.19 @storybook/addons: 5.3.19 => 5.3.19 @storybook/preset-create-react-app: 3.0.1 => 3.0.1 @storybook/preset-typescript: 3.0.0 => 3.0.0 @storybook/react: 5.3.19 => 5.3.19

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
hipstersmoothiecommented, Aug 20, 2020

PR is up now! https://github.com/styleguidist/react-docgen-typescript/pull/286

This doesn’t solve for defaults stored in another file. but i’ll wait til the next issue to fix that ;P

1reaction
shilmancommented, Jul 9, 2020

Thanks for upgrading. I’ll give it a look during the RC period!

Read more comments on GitHub >

github_iconTop Results From Across the Web

storybook/addon-docs - npm
DocsPage is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into clean, ...
Read more >
Addon API - Storybook - JS.ORG
The render function is called with active and key . The active value will be true when the panel is focused on the...
Read more >
In Storybook how can you display the full source of a ...
Right now in my team we are using Storybook v6 and the @storybook/addon-docs package in order to generate documentation for components.
Read more >
Docs to Markdown - Google Workspace Marketplace
for all items).No change to rendered HTML. - v1.0β14 (15 Jan. 2019): Name change to Docs to Markdown: now published on G Suite...
Read more >
React Top-Level API
Do not rely on it to “prevent” a render, as this can lead to bugs. Note. Unlike the shouldComponentUpdate() method on class components,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found