-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new default and custom colors for appchrome (#715)
These changes affect the AppChrome sidebar and header style. Changes include refactoring of components such as removing React.FC. BREAKING CHANGE: The fallback theme colors for the AppChrome component have been updated. The header fallback has changed from purple to white. The sidebar fallback has changed from black to gray.
- Loading branch information
1 parent
4ba391f
commit fa57957
Showing
14 changed files
with
208 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
import * as React from "react"; | ||
import { cx } from "@emotion/css"; | ||
import { flex } from "../../shared/styles/styleUtils"; | ||
import { useTheme } from "@emotion/react"; | ||
import { ThemeProvider, useTheme } from "@emotion/react"; | ||
import { headerBar } from "../style"; | ||
import { AppChromeTheme } from "../types"; | ||
import { getCSSVarValue } from "../../utilities"; | ||
import { themeBgPrimary } from "../../design-tokens/build/js/designTokens"; | ||
|
||
const Header: React.FC = ({ children }) => { | ||
export const defaultBgColor = getCSSVarValue(themeBgPrimary); | ||
export const defaultHeaderPaddingHor = "none"; | ||
export const defaultHeaderPaddingVert = "none"; | ||
|
||
interface HeaderProps { | ||
children?: React.ReactNode; | ||
/** | ||
* Changes the background color for the entire sidebar | ||
*/ | ||
bgColor?: string; | ||
} | ||
|
||
const StyledHeader = ({ children }: HeaderProps) => { | ||
const theme: AppChromeTheme = useTheme(); | ||
|
||
return ( | ||
<div className={cx(headerBar(theme), flex({ align: "center" }))}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
const Header = ({ bgColor, children }: HeaderProps) => { | ||
const adjustedTheme = ancestorTheme => { | ||
return { | ||
headerBackgroundColor: bgColor || getCSSVarValue(themeBgPrimary), | ||
...ancestorTheme | ||
}; | ||
}; | ||
|
||
return ( | ||
<ThemeProvider theme={adjustedTheme}> | ||
<StyledHeader>{children}</StyledHeader> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.