Royal-Navy / design-system

Build web applications that meet the Royal Navy service standards
https://storybook.design-system.navy.digital.mod.uk
Apache License 2.0
103 stars 32 forks source link

Expose a context/provider to allow access to sidebar state #2397

Open antictor opened 3 years ago

antictor commented 3 years ago

Description

I'm using the sidebar to show menu options and also the application version. It's hard to get the content to fit when in a closed state so it would really help if there was a context that could be used to get the current sidebar state and use that to determine the most appropriate content

m7kvqbe1 commented 3 years ago

@antictor

Could you please provide a real-world example of what you are trying to achieve?

It sounds like you are trying to change the size of the sidebar to account for custom content?

antictor commented 2 years ago

I'm trying to detect if the sidebar is open or closed so I can change the content it shows to match the size, so the opposite of what you said. In this case when it's open I want to say 'version: 1.0.0' but when it's closed use v1

github-actions[bot] commented 2 years ago

This issue has been marked as stale because it has been open for 60 days with no activity

github-actions[bot] commented 2 years ago

This issue has been marked as stale because it has been open for 60 days with no activity

m7kvqbe1 commented 2 years ago

@k9dh3zij Can you please cast an eye over this? Is this a misuse of sidebar?

k9dh3zij commented 2 years ago

@m7kvqbe1 @antictor Thanks for checking. I don't think this is a misuse of the sidebar, as we do allow content that adjusts depending on whether the sidebar is open or closed (eg. the classification bar which displays "OFFICIAL SENSITIVE" or "OS" respectively).

However, while it's OK to show a summary when closed, I'd be very careful to ensure the information displayed does not change. For example, "v1" is not a summary of "v1.6.99" and can be misleading (and also makes it potentially more difficult for tech support to explain to a user how to get the correct version; at the end of the day I'd ask "is it still useful to see just 'v1', or should I omit that altogether?"). In the example above, "OS" is a summary of "OFFICIAL SENSITIVE" and acts as a helpful reminder - it doesn't change the essence of "OFFICIAL SENSITIVE".

github-actions[bot] commented 2 years ago

This issue has been marked as stale because it has been open for 60 days with no activity