You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			35 lines
		
	
	
		
			692 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			35 lines
		
	
	
		
			692 B
		
	
	
	
		
			TypeScript
		
	
import { PrimaryColorStateType } from '../../themes/constants/colors';
 | 
						|
 | 
						|
export const APPLY_PRIMARY_COLOR = 'APPLY_PRIMARY_COLOR';
 | 
						|
 | 
						|
export const applyPrimaryColor = (color: PrimaryColorStateType) => {
 | 
						|
  return {
 | 
						|
    type: APPLY_PRIMARY_COLOR,
 | 
						|
    payload: color,
 | 
						|
  };
 | 
						|
};
 | 
						|
 | 
						|
export const initialPrimaryColorState: PrimaryColorStateType = 'green';
 | 
						|
 | 
						|
export const reducer = (
 | 
						|
  state: any = initialPrimaryColorState,
 | 
						|
  {
 | 
						|
    type,
 | 
						|
    payload,
 | 
						|
  }: {
 | 
						|
    type: string;
 | 
						|
    payload: PrimaryColorStateType;
 | 
						|
  }
 | 
						|
): PrimaryColorStateType => {
 | 
						|
  switch (type) {
 | 
						|
    case APPLY_PRIMARY_COLOR:
 | 
						|
      return payload;
 | 
						|
    default:
 | 
						|
      return state;
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
export const actions = {
 | 
						|
  applyPrimaryColor,
 | 
						|
};
 |