How to use the @axa-fr/react-toolkit-core.withClassDefault function in @axa-fr/react-toolkit-core

To help you get started, we’ve selected a few @axa-fr/react-toolkit-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AxaGuilDEv / react-toolkit / packages / badge / src / Badge.tsx View on Github external
const defaultProps: Partial = {
  children: null,
};

const omitProperties = PropsManager.omit(['classModifier']);

const BadgeRaw: React.SFC = ({ children, ...otherProps }) => (
  <span>{children}</span>
);

BadgeRaw.defaultProps = defaultProps;

interface BadgeProps extends WithClassModifierOptions, BadgeBaseProps {}

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(BadgeRaw);
Enhanced.displayName = 'Badge';
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / action / src / ActionCore.tsx View on Github external
tabIndex: 0,
  href: '#',
};

const omitProperties = PropsManager.omit(['classModifier']);

const ActionCore: React.FC = ({ icon, ...otherProps }) =&gt; (
  <a>
    <i>
  </i></a><i>
);

ActionCore.defaultProps = defaultProps;

const enhance = compose(
  withClassDefault(defaultClassName),
  withClassModifier,
  withProps(({ onClick, href, role }: ActionCoreProps) =&gt; ({
    href: onClick ? '#' : href || undefined,
    role: onClick ? 'button' : role || undefined,
  }))
);

const Enhanced = enhance(ActionCore);
Enhanced.displayName = 'ActionCore';
export default Enhanced;
</i>
github AxaGuilDEv / react-toolkit / packages / alert / src / AlertCore.tsx View on Github external
<div>{title}</div>
    
    {children &amp;&amp; (
      <div>
        <div>
        <div>{children}</div>
      </div>
    )}
  </div>
);

export type AlertCoreProps = AlertCoreComponentProps &amp; WithClassModifierOptions;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(AlertCoreRaw);
Enhanced.displayName = 'AlertCore';
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / tabs / src / Tab.tsx View on Github external
interface TabComponentProps {
  className?: string;
  title: string;
  children?: React.ReactNode;
  classModifier?: string;
}

const Tab: React.SFC = () =&gt; <span>;

const DEFAULT_CLASSNAME = 'af-tabs__pane';

export type TabProps = TabComponentProps &amp; WithClassModifierOptions;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(Tab);
Enhanced.displayName = 'TabCore';
export default Enhanced;
</span>
github AxaGuilDEv / react-toolkit / packages / Modal / default / src / HeaderBase.ts View on Github external
import {
  withClassDefault,
  withClassModifier,
  WithClassModifierOptions,
  compose,
} from '@axa-fr/react-toolkit-core';
import Div, { DivProps } from './Div';

const DEFAULT_CLASSNAME = 'af-modal__header';

export type HeaderBaseProps = DivProps &amp; WithClassModifierOptions;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(Div);
Enhanced.displayName = 'HeaderBase';
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / table / src / Body.tsx View on Github external
compose,
} from '@axa-fr/react-toolkit-core';

const DEFAULT_CLASSNAME = 'af-table__body';

export type BodyComponentProps = React.HTMLProps;

const Body: React.SFC = props =&gt; {
  const { children, className } = props;

  return {children};
};

export type BodyProps = BodyComponentProps &amp; WithClassModifierOptions;
const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

Body.displayName = 'Table.Body';

export default enhance(Body);
github AxaGuilDEv / react-toolkit / packages / restitution / src / HeaderRestitution.tsx View on Github external
{title &amp;&amp; <span>{title}</span>}
          <span>{subtitle}</span>
        
      
      {rightTitle &amp;&amp; (<div>
        <span>
          {rightTitle}
        </span>
      </div>)}
    
  );

type HeaderRestitutionProps = WithClassModifierOptions &amp; HeaderRestitutionBaseProps;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const defaultProps: Partial = {
  className: DEFAULT_CLASSNAME
};

const Enhanced = enhance(HeaderRestitution);
Enhanced.displayName = 'HeaderRestitution';
Enhanced.defaultProps = defaultProps;

export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / table / src / TableCore.tsx View on Github external
const DEFAULT_CLASSNAME = 'af-table';

export type TableCoreComponentProps = Pick&lt;
  React.HTMLProps,
  'className'
&gt;;

const TableCore: React.SFC = props =&gt; {
  const { className, children } = props;
  return {children}<table></table>;
};

export type TableCoreProps = TableCoreComponentProps &amp; WithClassModifierOptions;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);
TableCore.displayName = 'TableCore';
export default enhance(TableCore);
github AxaGuilDEv / react-toolkit / packages / Layout / footer / src / FooterCore.tsx View on Github external
}) =&gt; (
  <footer>
    <div>
      <a title="{title}" href="{href}">
        <img alt="{alt}" src="{icon}">
      </a>
      <div>{children}</div>
    </div>
  </footer>
);
FooterCoreRaw.defaultProps = defaultProps;

export type FooterCoreProps = FooterCoreComponentProps &amp; WithClassModifierOptions;

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(FooterCoreRaw);
Enhanced.displayName = 'FooterCore';
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / tabs / src / Pane.tsx View on Github external
&gt;;

interface PaneComponentProps extends DivProps {
  active: boolean;
  className?: string;
  children?: React.ReactNode;
}
const Pane: React.SFC = ({ children, className, active }) =&gt; {
  if(!active) {
    return null;
  }
  return (<div>{children}</div>);
};

const enchance = compose(
  withClassDefault(DEFAULT_CLASSNAME)
)(Pane);

export default enchance;