This repository was archived by the owner on Mar 4, 2020. It is now read-only.
feat(Knobs): improve useRangeKnob() and add LogInspector/useLogKnob()#1876
Merged
layershifter merged 9 commits intomasterfrom Sep 6, 2019
Merged
feat(Knobs): improve useRangeKnob() and add LogInspector/useLogKnob()#1876layershifter merged 9 commits intomasterfrom
useRangeKnob() and add LogInspector/useLogKnob()#1876layershifter merged 9 commits intomasterfrom
Conversation
Collaborator
Changed dependencies are detected.Changed peerDependencies in
Generated by 🚫 dangerJS |
Codecov Report
@@ Coverage Diff @@
## master #1876 +/- ##
======================================
Coverage 69.9% 69.9%
======================================
Files 888 888
Lines 7775 7775
Branches 2244 2244
======================================
Hits 5435 5435
Misses 2330 2330
Partials 10 10Continue to review full report at Codecov.
|
layershifter
commented
Sep 5, 2019
| "main": "dist/commonjs/index.js", | ||
| "module": "dist/es/index.js", | ||
| "peerDependencies": { | ||
| "prettier": "^1.18.2", |
Member
Author
There was a problem hiding this comment.
We are using it under packages/docs-components/src/CodeSnippet/formatCode.ts.
useRangeKnob() and add LogInspector/useCallbackLog()useRangeKnob() and add LogInspector/useLogKnob()
lucivpav
reviewed
Sep 6, 2019
| const useLogKnob = <T = (...args: any[]) => any>( | ||
| name: string, | ||
| callback?: T, | ||
| formatter: Function = defaultFormatter, |
Contributor
There was a problem hiding this comment.
Can we specify the formatter type, instead of using a general Function? For instance, it would be nice to specify that the function should return string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
useLogKnob()andLogInspectorThis PR adds and knob and component, this drastically simplifies examples and allows to log callbacks. There are two examples of
useLogKnob():PortalExampleOpen.tsxandDialogExampleCallbacks.shorthand.tsx.Second is more advanced as contains custom output formatter:
useRangeKnob()Was improved to support
min,maxandstepprops. Logic with parsing values was moved out fromKnobRangeso it will be easier to integrate custom components.