fix(theming): allow theming of typescript consumers #984
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix
as the original export wasn't providing any information.Description
This PR modifies how we provide and consume our
GardenTheme
interface withinreact-theming
. These changes will make it possible for other codebases to more easily consume our theme within TypeScript codebases.Detail
styled-components
requires consumers to define their own DefaultTheme within their codebase. We've accomplished this in ourreact-components
andwebsite
repositories.Up to this point we have been exporting the
DefaultTheme
object from styled-components within thereact-theming
package. Due to the ponyfill approach above this has actually been exporting an empty ({}
) interface this whole time 🤦Approach
The new approach is to define a separate
IGardenTheme
interface that defines the expected structure of the Garden theme. This new interface is only used in theThemeProvider
component. All other usages and utilities still consume theDefaultTheme
from styled-components to allow consumers the flexibility to customize the theme structure.For consuming codebases this would be the format to type their theme:
Checklist
👌 design updates are Garden Designer approved (add thedesigner as a reviewer)
yarn start
)?bedrock
)♿ analyzed via axe and evaluated using VoiceOver💂♂️ includes new unit tests