Skip to content

Commit

Permalink
Dublicate Functionality from BaseLayout into HeaderithActions
Browse files Browse the repository at this point in the history
Need refactoring
  • Loading branch information
NilsBaumgartner1994 committed Jul 28, 2023
1 parent 4d020b0 commit 0175e7b
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Heading, Text, useContrastText, View} from "native-base";
import {useSynchedDrawerConfig} from "../synchedstate/SynchedState";
import {Navigation} from "../navigation/Navigation";
import {useMyContrastColor} from "../theme/useMyContrastColor";
import {useProjectColor, useThemedShade} from "kitcheningredients";

export interface AppState{
renderActions?: () => any;
Expand All @@ -15,9 +16,26 @@ export interface AppState{
showbackbutton?: boolean;
backgroundColor?: string
textColor?: string,
headerShadeLevel?: number
useProjectHeaderBackgroundColor?: boolean
}
export const HeaderWithActions: FunctionComponent<AppState> = (props) => {
const headerBackgroundColor = props?.backgroundColor;
const projectColor = useProjectColor();
let headerShadeLevel = props?.headerShadeLevel
if(headerShadeLevel===undefined) {
headerShadeLevel = 1;
}
const themedBackgroundColor = useThemedShade(headerShadeLevel);
let headerBackgroundColor = props?.backgroundColor;

if(!headerBackgroundColor){
if(props?.useProjectHeaderBackgroundColor){
headerBackgroundColor = projectColor;
} else {
headerBackgroundColor = themedBackgroundColor
}
}

let headerTextColor = props?.textColor;
if(!headerTextColor){
headerTextColor = useMyContrastColor(headerBackgroundColor);
Expand Down

0 comments on commit 0175e7b

Please sign in to comment.