oui icon indicating copy to clipboard operation
oui copied to clipboard

[BUG] Playground Toggle Missing in `Bottom Bar` and `Flex` Sections of Layout Docs

Open willie-hung opened this issue 1 year ago • 7 comments

Describe the bug

When navigating to the "Layout" documentation and clicking on either the "Bottom bar" or "Flex" sections, both playground toggle is missing.

To Reproduce

  1. Go to Layout
  2. In Bottom bar and Flex tab
  3. The playground toggles are missing

Screenshots

v1.3

Screenshot 2023-11-02 at 6 23 07 PM Screenshot 2023-11-02 at 6 22 26 PM

v2.0

Screenshot 2023-11-02 at 6 23 22 PM Screenshot 2023-11-02 at 6 21 31 PM

Expected behavior

The playground toggle should appear in v2.0 too

Host/Environment (please complete the following information):

  • OUI Version: v2.0
  • OS: macOS arm64

willie-hung avatar Nov 02 '23 23:11 willie-hung

Just by reading through this, I have a few thoughts:

  1. Does this occur over the entire docsite, or just in a few places?
  2. Does this occur on pages that have multiple playground sections? E.g. flex

BSFishy avatar Nov 02 '23 23:11 BSFishy

@BSFishy,

Just to complement what @Willie-The-Lord is bringging, this also happened to me when I was playing with the OuiFlexItem and OuiBottomBar components on the Documentation page last week. Belo some Screenshots:

v1.3 image image v2.0 image image

Regards,

Samuel

BigSamu avatar Nov 05 '23 23:11 BigSamu

@BSFishy @joshuarrrr

I want to work on this issue.

BigSamu avatar Nov 07 '23 17:11 BigSamu

@BSFishy , @joshuarrrr

I found the problem with this issue. It is related to the file guide_section.tsx. What caught my attention are the lines 135 and 136 . Why is the const isPlaygroundUnsupported defined as follows?

const isPlaygroundUnsupported =
      typeof window != 'undefined' && typeof document !== 'undefined';

It should be the following in my opinion

const isPlaygroundUnsupported =
      typeof window == 'undefined' || typeof document !== 'undefined';

This problem didn't appear until a change was brought in the commit 02d0b4, line 136 . Essentially before that change variable isPlaygroundUnsupported was always true if you were using a browser different from Explorer.

By introducing my suggested change, the playground toggle button appears back with no problems.

Regards,

Samuel

BigSamu avatar Nov 20 '23 18:11 BigSamu

Hey @BigSamu, it seems like you tag the wrong person.

willie-hung avatar Nov 20 '23 18:11 willie-hung

Hey @BigSamu, it seems like you tag the wrong person.

Fixed. Thanks Will!

BigSamu avatar Nov 20 '23 19:11 BigSamu

Hi @joshuarrrr, @BSFishy,

I have recently created PR #1162 with the suggested change I mentioned before. Looking forward to your comments.

Regards,

Samuel

BigSamu avatar Nov 21 '23 16:11 BigSamu