elements icon indicating copy to clipboard operation
elements copied to clipboard

fix: allow to display the code samples when try it panel is hidden

Open weyert opened this issue 1 year ago • 6 comments

Changes

  • Modified the rendering logic of the TryIt component to ensure it generates request data regardless of the TryIt panel's visibility.
  • Ensured that the request sample is consistently displayed on the page by decoupling the request data generation from the TryIt panel's display state.

Rationale

Previously, the request sample could not be displayed without rendering the TryIt panel, which was a limitation. This change allows the request sample by not visually rendering the TryIt Panel when its opted out off.

Testing

  • Verified that the request sample is correctly displayed when the TryIt panel is hidden.
  • Ensured no regressions in the display of the TryIt panel and its functionality.

Elements Default PR Template

In general, make sure you have: (check the boxes to acknowledge you've followed this template)

  • [X] Read CONTRIBUTING.md

Other Available PR Templates:

  • Release: https://github.com/stoplightio/elements/compare?template=release.md
    • [ ] Read the release section of CONTRIBUTING.md

weyert avatar Jul 26 '24 21:07 weyert

Deploy Preview for stoplight-elements ready!

Name Link
Latest commit 6e89828631553a4f0d0d261326804e8c49926d23
Latest deploy log https://app.netlify.com/sites/stoplight-elements/deploys/672a09e3534c5d00085543a7
Deploy Preview https://deploy-preview-2624--stoplight-elements.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.

netlify[bot] avatar Jul 26 '24 21:07 netlify[bot]

Deploy Preview for stoplight-elements-demo ready!

Name Link
Latest commit 6e89828631553a4f0d0d261326804e8c49926d23
Latest deploy log https://app.netlify.com/sites/stoplight-elements-demo/deploys/672a09e32c8e7800083b478d
Deploy Preview https://deploy-preview-2624--stoplight-elements-demo.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.

netlify[bot] avatar Jul 26 '24 21:07 netlify[bot]

LGTM!

mnaumanali94 avatar Aug 01 '24 08:08 mnaumanali94

@weyert Can we also update the docs please

mnaumanali94 avatar Aug 01 '24 08:08 mnaumanali94

Yeah, I will do. Probably tomorrow.

weyert avatar Aug 01 '24 12:08 weyert

Totally forgot about it @mnaumanali94 I have added the call out in the documentation now.

weyert avatar Aug 15 '24 13:08 weyert