Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example generator [LG-2954, LG-2950, LG-2951] #259

Merged
merged 31 commits into from
Apr 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7f99f04
Updates component name parsing
TheSonOfThomp Apr 20, 2023
6a4904e
Update LiveExample.tsx
TheSonOfThomp Apr 20, 2023
bfd472b
Parse React Tree to generate code example
TheSonOfThomp Apr 21, 2023
111f37f
update package json & config
TheSonOfThomp Apr 21, 2023
9079c89
Merge branch 'staging' into code-example
TheSonOfThomp Apr 21, 2023
e510252
Merge branch 'live-example-decorators' into code-example
TheSonOfThomp Apr 21, 2023
c613d00
Update LiveExampleError.tsx
TheSonOfThomp Apr 21, 2023
5873644
adds pascalcase
TheSonOfThomp Apr 21, 2023
eae3f0e
update comment with issue reference
TheSonOfThomp Apr 21, 2023
ffc57a3
Merge branch 'live-example-decorators' into code-example
TheSonOfThomp Apr 24, 2023
e4a15ed
ignore default props
TheSonOfThomp Apr 24, 2023
a439b06
Merge branch 'staging' into code-example
TheSonOfThomp Apr 24, 2023
d0f3d20
refactor knob table component
TheSonOfThomp Apr 24, 2023
2649d0e
ensure table is sorted
TheSonOfThomp Apr 24, 2023
f355bb3
mv knobrow & knob
TheSonOfThomp Apr 24, 2023
6ca3477
Sort knobs same as tsdocs
TheSonOfThomp Apr 24, 2023
4f90e8c
Adds required flag
TheSonOfThomp Apr 24, 2023
46b9667
Update tsdoc.utils.ts
TheSonOfThomp Apr 24, 2023
2cab227
use isRequired in knobs table
TheSonOfThomp Apr 24, 2023
b888986
rm var
TheSonOfThomp Apr 24, 2023
a666ce4
bumps versions
TheSonOfThomp Apr 24, 2023
e038f0e
Merge branch 'code-example' into knobs-table
TheSonOfThomp Apr 24, 2023
e8ea489
Merge branch 'staging' into code-example
TheSonOfThomp Apr 24, 2023
f976fe2
Merge branch 'staging' into knobs-table
TheSonOfThomp Apr 24, 2023
dc081d5
makes story code parsing more efficient
TheSonOfThomp Apr 25, 2023
63a2d8e
exclude key prop
TheSonOfThomp Apr 25, 2023
d4bd19b
adds key to ignore props
TheSonOfThomp Apr 25, 2023
9678b1b
Merge branch 'staging' into code-example
TheSonOfThomp Apr 25, 2023
8780cd4
Merge branch 'staging' into code-example
TheSonOfThomp Apr 25, 2023
10f9bd7
Merge branch 'code-example' into knobs-table
TheSonOfThomp Apr 25, 2023
6f875bd
Merge pull request #260 from mongodb/knobs-table
TheSonOfThomp Apr 25, 2023
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
13 changes: 8 additions & 5 deletions components/pages/example/utils/getStoryCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ export function getStoryCode(context: LiveExampleContext): string | undefined {
filterProps: (value, name) => {
const tsProp = TSPropsArray.find(p => p.name === name);
const tsDefault = tsProp ? getDefaultValueValue(tsProp) : null;

const excludeProp =
ignoreAllPropsForComponents.includes(componentName) ||
ignoreProps.includes(name) ||
value === tsDefault ||
name === 'key';
TheSonOfThomp marked this conversation as resolved.
Show resolved Hide resolved

// Filter out explicitly ignored props
// and props that have the same value as the documented default
return (
!ignoreAllPropsForComponents.includes(componentName) &&
!ignoreProps.includes(name) &&
value !== tsDefault
);
return !excludeProp;
},
});

Expand Down