Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
feat(ThemeSection): Include parent themeSection
Browse files Browse the repository at this point in the history
Also adds the name of the current & parent themeSection
to the theme context for better debugging
  • Loading branch information
diondiondion committed Mar 2, 2020
1 parent 000d099 commit 0a21ad4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ThemeSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function ThemeSection(props) {

const constructLocalTheme = useCallback(
(parentTheme = baseTheme) => {
const localThemeSection = parentTheme.sections[name];
const parentThemeSectionName = parentTheme.currentThemeSectionName;
const colorBlockOverrides = getReadableColorblock(
parentTheme.globals.colorBlocks,
colorBlock,
Expand All @@ -18,8 +20,11 @@ function ThemeSection(props) {

return {
...parentTheme,
...parentTheme.sections[name],
...localThemeSection,
...colorBlockOverrides,
currentThemeSectionName: name,
parent: parentTheme.sections[parentThemeSectionName],
parentThemeSectionName,
};
},
[baseTheme, colorBlock, hasBgImage, name]
Expand Down

0 comments on commit 0a21ad4

Please sign in to comment.