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)
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)