How to use the @axa-fr/react-toolkit-core.compose 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 / table / src / Th.tsx View on Github external
/* if (typeof children === 'string') {
    return (
      
        <span>{children}</span>
      
    );
  } */

  return (
    
      {children}
    
  );
};
export type ThProps = ThComponentProps &amp; WithClassModifierOptions;
const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

Th.defaultProps = defaultProps;
Th.displayName = 'Table.Th';

export default enhance(Th);
github AxaGuilDEv / react-toolkit / packages / restitution / src / ArticleRestitution.tsx View on Github external
}

type ArticleRestitutionProps = WithClassModifierOptions &amp; ArticleRestitutionBaseProps ;

const ArticleRestitution= ({ children, className }:ArticleRestitutionBaseProps) =&gt; (
    <article>
    {children}
    </article>
  );

const defaultProps: Partial = {
  children: null,
  className:DEFAULT_CLASSNAME
};

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

const Enhanced = enhance(ArticleRestitution);
Enhanced.displayName = 'ArticleRestitution';
Enhanced.defaultProps = defaultProps;
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / tabs / src / Title.tsx View on Github external
const DEFAULT_CLASSNAME = 'af-tabs__item';

export type TitleProps = TitleComponentProps &amp;
  TitleHandlerProps &amp;
  WithClassModifierOptions;

const setWithProps = (props: TitleComponentProps) =&gt; ({
  ...props,
  classModifier: (props.classModifier || '').concat(
    (props.enable === false ? ' disabled' : '').concat(
      props.active ? ' active' : ''
    )
  ),
});

const enchance = compose(
  withProps(setWithProps),
  withClickId({ event: [onChangeEvent] }),
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
)(Title);

enchance.displayName = 'Title';

export default enchance;
github AxaGuilDEv / react-toolkit / packages / restitution / src / SectionRestitutionRow.tsx View on Github external
children?: React.ReactNode;
  title?: React.ReactNode;
  classNameContainer?: string;
  className?: string;
}

const SectionRestitutionRow = ({ title, className, classNameContainer, children }:SectionRestitutionRowBaseProps) =&gt; (<div>
    {title &amp;&amp; }
    <div>
      {children}
    </div>
  </div>);

type SectionRestitutionRowProps = WithClassModifierOptions &amp; SectionRestitutionRowBaseProps;

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

const defaultProps: Partial = {
  children: null,
  classNameContainer: "row af-restitution__content-left",
  className:DEFAULT_CLASSNAME
};

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

export default Enhanced;
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 / Modal / default / src / Body.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__body';

export type BodyProps = DivProps &amp; WithClassModifierOptions;

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

const Enhanced = enhance(Div);
Enhanced.displayName = 'Body';
export default Enhanced;
github AxaGuilDEv / react-toolkit / packages / table / src / Header.tsx View on Github external
const Header: React.SFC = props =&gt; {
  const { children, headers, className } = props;

  if (headers) {
    return (
      
        {children}
      
    );
  }
  return {children};
};

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

Header.displayName = 'Table.Header';

export default enhance(Header);
github AxaGuilDEv / react-toolkit / packages / Layout / footer / src / FooterCore.tsx View on Github external
children,
}) =&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 / button / src / Button.tsx View on Github external
import { withClickId, WithClickIdProps, compose } from '@axa-fr/react-toolkit-core';

import ButtonCore, { ButtonCoreProps } from './ButtonCore';

export type ButtonProps = WithClickIdProps;

const Button = compose(
  withClickId({ event: ['onClick'] })
)(ButtonCore);

Button.displayName = "Button";

export default Button;
github AxaGuilDEv / react-toolkit / packages / action / src / Action.ts View on Github external
import { WithClickIdProps, withClickId, compose } from '@axa-fr/react-toolkit-core';
import ActionCore, { ActionCoreProps } from './ActionCore';

export type ActionProps = WithClickIdProps;

const Action = compose(
  withClickId({ event: ['onClick'] })
)(ActionCore);
Action.displayName = 'Action';

export default Action;