ic-design-system icon indicating copy to clipboard operation
ic-design-system copied to clipboard

Persist a user's chosen language and framework for code demos

Open GCHQ-Developer-112 opened this issue 1 year ago • 1 comments

Summary

Add a functional cookie to local storage that stores a user's chosen language and framework. When the Javascript/Typescript toggle button is added to the ComponentPreview component, users, in particular React users, will have to take additional steps to select their chosen framework and language (depending on the default language). By saving their preference in a cookie, we can improve their user experience and ensure they always see code examples in their chosen framework and language.

💰 User value

This will improve the user experience as users will not have to constantly switch to their preferred coding framework and language.

📝 Acceptance Criteria

Given I am a developer using the ICDS guidance site, When I select my preferred framework (and language if applicable) in a code demo Then I should see all future code demos in the framework (and language if applicable)

Given I am a developer using the ICDS guidance site, And I have previously selected my preferred framework (and language if applicable) in a code demo When I change my preferred framework (and language if applicable) in a code demo Then I should see all future code demos in the newly selected framework (and language if applicable)

GCHQ-Developer-112 avatar Feb 15 '24 10:02 GCHQ-Developer-112

Consider if we use cookies (but would need to implement a way to have essential cookies in settings) or local storage

MI6-255 avatar May 16 '24 09:05 MI6-255