{"size": 1095, "ext": "js", "max_stars_repo_path": "src/app/store/reducers/items/app/data/settings/components/header/Header.babel.js", "max_stars_repo_name": "UnderJollyRoger/storymap-crowdsource", "max_stars_repo_stars_event_min_datetime": "2016-08-08T14:06:40.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-09T12:44:56.000Z", "max_issues_repo_path": "src/app/store/reducers/items/app/data/settings/components/header/Header.babel.js", "max_issues_repo_name": "UnderJollyRoger/storymap-crowdsource", "max_issues_repo_issues_event_min_datetime": "2016-10-04T18:06:33.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-06T15:12:59.000Z", "max_forks_repo_path": "src/app/store/reducers/items/app/data/settings/components/header/Header.babel.js", "max_forks_repo_name": "UnderJollyRoger/storymap-crowdsource", "max_forks_repo_forks_event_min_datetime": "2016-06-16T17:10:55.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-24T23:44:30.000Z"}
{"max_stars_count": 28, "max_issues_count": 18, "max_forks_count": 45, "avg_line_length": 24.8863636364, "max_line_length": 61, "alphanum_fraction": 0.7059360731}
import $ from 'jquery';
import { combineReducers } from 'redux';
import {
  UPDATE_SETTINGS_HEADER_TITLE,
  UPDATE_SETTINGS_HEADER_LOGO_TYPE,
  UPDATE_SETTINGS_HEADER_LOGO_URL,
  UPDATE_SETTINGS_HEADER_LOGO_LINK
} from 'babel/constants/actionsTypes/Settings';

const defaultLogo = {
  type: 'esri',
  source: 'resources/images/logo/esri-logo-reversed.svg',
  link: 'http://www.esri.com/'
};

export const title = function (state = '', action) {
  switch (action.type) {
    case UPDATE_SETTINGS_HEADER_TITLE:
      return action.title;
    default:
      return state;
  }
};

export const logo = function (state = defaultLogo, action) {
  switch (action.type) {
    case UPDATE_SETTINGS_HEADER_LOGO_TYPE:
      return $.extend(true,{},state,{type: action.logoType});
    case UPDATE_SETTINGS_HEADER_LOGO_URL:
      return $.extend(true,{},state,{source: action.url});
    case UPDATE_SETTINGS_HEADER_LOGO_LINK:
      return $.extend(true,{},state,{link: action.link});
    default:
      return state;
  }
};

export const header = combineReducers({
  logo,
  title
});

export default header;
