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

feat: Add auto state controls (fix #191) #673

Merged
merged 4 commits into from
Feb 4, 2024
Merged

Conversation

hugoattal
Copy link
Collaborator

Fix #191

Description

Add placeholder with default value when auto-detected props are undefined
image

Add auto state controls when there are no template#controls and initState exists.
image

Additional context

Displaying default values like the issue suggests is not a good solution IMO, as if the same state value is used for two props, the values would be unlinked.

I think generating automatic controls for the state should solve the issue mentioned. Wdyt?


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@hugoattal hugoattal self-assigned this Feb 4, 2024
Copy link

codesandbox bot commented Feb 4, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

stackblitz bot commented Feb 4, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Feb 4, 2024

Deploy Preview for histoire-examples-svelte3 ready!

Name Link
🔨 Latest commit 391a3d8
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-svelte3/deploys/65bf9664c0401900072d315a
😎 Deploy Preview https://deploy-preview-673--histoire-examples-svelte3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 4, 2024

Deploy Preview for histoire-examples-vue3 ready!

Name Link
🔨 Latest commit 391a3d8
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-vue3/deploys/65bf966458ff670008c40e05
😎 Deploy Preview https://deploy-preview-673--histoire-examples-vue3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 4, 2024

Deploy Preview for histoire-controls ready!

Name Link
🔨 Latest commit 391a3d8
🔍 Latest deploy log https://app.netlify.com/sites/histoire-controls/deploys/65bf9664f3beeb00071086cc
😎 Deploy Preview https://deploy-preview-673--histoire-controls.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 4, 2024

Deploy Preview for histoire-site ready!

Name Link
🔨 Latest commit 391a3d8
🔍 Latest deploy log https://app.netlify.com/sites/histoire-site/deploys/65bf9664e677d20008c174ad
😎 Deploy Preview https://deploy-preview-673--histoire-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hugoattal hugoattal requested a review from Akryum February 4, 2024 12:20
@Akryum Akryum merged commit 13c75b5 into main Feb 4, 2024
21 checks passed
@Akryum Akryum deleted the feat/state-controls branch February 4, 2024 14:44
@alexzhang1030
Copy link

When will this version land in npmjs?

@hugoattal
Copy link
Collaborator Author

hugoattal commented Feb 28, 2024

@alexzhang1030 It's already available. Keep in mind that the auto state should be displayed only if no custom controls are provided.

Here is an example: https://github.com/histoire-dev/histoire/blob/main/examples%2Fvue3%2Fsrc%2Fcomponents%2FAutoStateProps.story.vue

@alexzhang1030
Copy link

Thank you, it's released now, but I saw the version in npm is still 0.17.9, it looks like it has not been published yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display default values/initial state of props in the auto props controls
3 participants