/*
Copyright (c) 2018-2020 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
// BASEUI-GENERATED-REACT-ICON
// DO NOT EDIT THIS FILE DIRECTLY, SEE README.md
import * as React from 'react';
import Icon from './icon.js';
import omitDollarPrefixedKeys from './omit-dollar-prefixed-keys.js';
import type {IconPropsT} from './types.js';
import {ThemeContext} from '../styles/theme-provider.js';

export default function %%ICON_NAME%%(props: IconPropsT) {
  return (
    <ThemeContext.Consumer>
      {theme => (
        theme.icons && theme.icons.%%ICON_NAME%% ?
        (
          <theme.icons.%%ICON_NAME%%
            %%ICON_PROPS%%
            {...omitDollarPrefixedKeys(props)}
          />
        ) : (
          <Icon %%ICON_PROPS%% {...props}>
            %%ICON_PATH%%
          </Icon>
        )
      )}
    </ThemeContext.Consumer>
  );
}
