Skip to content

Commit

Permalink
feat(project): get header background from config
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Jun 8, 2021
1 parent 61b0b1f commit 16b134c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.header {
height: variables.$header-height;
padding: 10px variables.$base-spacing * 4;
background: var(--header-background);

//
// Make header fixed
Expand Down
5 changes: 4 additions & 1 deletion src/providers/ConfigProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const ConfigProvider: FunctionComponent<ProviderProps> = ({
loadAndValidateConfig(configLocation);
}, [configLocation, onLoading, onValidationError]);

const setCssVariables = ({ backgroundColor, highlightColor }: Options) => {
const setCssVariables = ({ backgroundColor, highlightColor, headerBackground }: Options) => {
const root = document.querySelector(':root') as HTMLElement;

if (root && backgroundColor) {
Expand All @@ -68,6 +68,9 @@ const ConfigProvider: FunctionComponent<ProviderProps> = ({
if (root && highlightColor) {
root.style.setProperty('--highlight-color', highlightColor);
}
if (root && headerBackground) {
root.style.setProperty('--header-background', headerBackground);
}
};

return (
Expand Down

0 comments on commit 16b134c

Please sign in to comment.