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

Add a show more / show less button to component or pattern demos to expand or collapse the code snippet. #774

Closed
DBD324 opened this issue Jan 18, 2024 · 1 comment
Assignees
Milestone

Comments

@DBD324
Copy link
Contributor

DBD324 commented Jan 18, 2024

Summary

Some code snippets are very long and if displayed in full would cause the page length to be very long. A show more / show less button would allow the snippets to be collapsed when not in use reducing the page length.

💬 Description

Explore ways of adding show more/less to component demos.
Consider a button in the toolbar, a text link in the snippet itself, or a floating action button.

💰 User value

Allows pages to be shortened avoiding lengthy page scrolls. Allows full code to be viewed upon request.

📚 User Stories

If relevant, describe the high-level functionality as user stories.

As an ICDS user:
I need to be able to expand and collapse code snippets
So that they don't cause page lengths to be unnecessarily long.

📝 Acceptance Criteria

If relevant, describe in full detail the different interactions and edge cases that the component or patterns needs to fulfil.

Given that a code demo is being set up
When being configured
Then an option exists to allow the snippet to be expandable
and an option exists to set initial state of collapsed or expanded,
and an option exists to set the number of lines displayed in the collapsed state.

Given that an expandable code snippet is being set up
When specifying the code
Then an option exists to specify the collapsed code in full, and the expanded code in full.
(this is so that aspects of the code can be hidden from the start of the snippet as well as the end, such as with imports)

Given that an expandible code demo exists
When an external trigger occurs
Then an option to programmatically control the expansion can be used.

Given that an expandible code demo exists
When rendered
Then a UI control exists to expand or collapse the snippet.

Given that an expandible code demo exists
When the expand button is actioned,
Then the code snippet should expand to show the snippet in full
And page content below should be pushed to accommodate.

✏ Designs

Please see the 'Component Library - ICDS Guidance Site' Figma file for visual designs.

## 🧾 Guidance
N/A

Additional info

Tell us anything else useful to help us understand your suggestion.

@DBD324 DBD324 added this to the PI 6 V.2 milestone Jan 18, 2024
@DBD324 DBD324 moved this from Design to-do to Design In progress in Intelligence Community Design System Jan 24, 2024
@DBD324 DBD324 self-assigned this Jan 24, 2024
@DBD324 DBD324 moved this from Design In progress to In Refinement in Intelligence Community Design System Jan 29, 2024
@ASM995 ASM995 moved this from In Refinement to Ready for dev in Intelligence Community Design System Feb 1, 2024
@GCHQ-Developer-847
Copy link
Contributor

Just another thing to keep in mind about this - when the user clicks the "Copy code" button, we'd probably want it to copy whichever amount of code is visible, i.e. once you've expanded the code, it will change to copying the longer amount code.

@ASM995 ASM995 modified the milestones: PI 6 V.2, PI 7 V.2 Mar 28, 2024
GCHQ-Developer-112 added a commit that referenced this issue Apr 8, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 8, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
@GCHQ-Developer-112 GCHQ-Developer-112 self-assigned this Apr 9, 2024
@GCHQ-Developer-112 GCHQ-Developer-112 moved this from Ready for dev to Dev In Progress in Intelligence Community Design System Apr 9, 2024
GCHQ-Developer-112 added a commit that referenced this issue Apr 11, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 11, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 12, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 12, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 12, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 14, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 15, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 16, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 16, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 18, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 18, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 18, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 18, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Apr 18, 2024
updated code examples to work with the new Stackblitz functionality, add toggle button to switch
between typescript and javascript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 21, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 21, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 21, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 21, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 22, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 22, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 22, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 23, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 24, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 30, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-530 pushed a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-530 pushed a commit that referenced this issue May 31, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 4, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 4, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 4, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 4, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 5, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 12, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 13, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 13, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
@GCHQ-Developer-112 GCHQ-Developer-112 moved this from Dev In Progress to In Review in Intelligence Community Design System Jun 13, 2024
GCHQ-Developer-112 added a commit that referenced this issue Jun 13, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
GCHQ-Developer-112 added a commit that referenced this issue Jun 14, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
gd2910 pushed a commit that referenced this issue Jun 27, 2024
update code examples to work with the new Stackblitz functionality, add toggle button to switch
between TypeScript and JavaScript, add show more/less button to component code examples

. #773 #774 #751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants