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

Commit

Permalink
ambiance: extract all lum values from source
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemolland committed Feb 22, 2022
1 parent 55f9d22 commit 49e98ec
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/providers/AmbianceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type AmbianceProps = {
child?: AmbianceProps
color: string
elevation: number
source?: string
}

type AmbianceProviderProps = {
Expand All @@ -26,6 +27,7 @@ const Ambiance: React.FC<AmbianceProviderProps> = ({
}: AmbianceProviderProps) => {
const parent = React.useContext(AmbianceContext)
const theme = useTheme()
let source

if (!parent && typeof elevation === 'undefined') {
elevation = 0
Expand All @@ -39,12 +41,19 @@ const Ambiance: React.FC<AmbianceProviderProps> = ({
color = parent.root.color
}

if (!parent) {
source = color
} else {
source = parent.source
}

let tmp = {
bottom: null,
root: null,
parent,
elevation,
color: getColorFromElevation(color, elevation)
color: getColorFromElevation(source, elevation),
source
}

let value: AmbianceProps = {
Expand Down

0 comments on commit 49e98ec

Please sign in to comment.