You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a GOVUKFrontendConfigurableComponent class that extends GOVUKFrontendComponent and encapsulate storing the configuration computed by getComponentConfiguration in this.config (similarly to how GOVUKFrontendComponent encapsulates storing the root of the component)
The constructor signature would be constructor(root, config).
Type wise, it’ll need to be a generic class, to allow components extending it to specify the type of the configuration object they work on: ConfigurableComponent<ConfigurationType, RootElementType> (configuration type first as it’s necessarily specified, while RootElementType is optional).
Update the components using getComponentConfiguration to use it.
Why
This would add further consistency to how components receive configuration, formalising the name of the variable storing the configuration and encapsulating a behaviour repeated by all components receiving configuration.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
We added the GOVUKFrontendConfigurableComponent class
We've updated our components to use it
The text was updated successfully, but these errors were encountered:
What
Create a
GOVUKFrontendConfigurableComponent
class that extendsGOVUKFrontendComponent
and encapsulate storing the configuration computed bygetComponentConfiguration
inthis.config
(similarly to howGOVUKFrontendComponent
encapsulates storing the root of the component)The constructor signature would be
constructor(root, config)
.Type wise, it’ll need to be a generic class, to allow components extending it to specify the type of the configuration object they work on:
ConfigurableComponent<ConfigurationType, RootElementType>
(configuration type first as it’s necessarily specified, while RootElementType is optional).Update the components using
getComponentConfiguration
to use it.Why
This would add further consistency to how components receive configuration, formalising the name of the variable storing the configuration and encapsulating a behaviour repeated by all components receiving configuration.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
GOVUKFrontendConfigurableComponent
classThe text was updated successfully, but these errors were encountered: