How to use the @rmwc/base.classNames function in @rmwc/base

To help you get started, we’ve selected a few @rmwc/base 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 jamesmfriedman / rmwc / src / icon / index.tsx View on Github external
strategyToUse === 'custom'
        ? render || providerRender
        : rendererFromMap || null;

    if (!renderToUse) {
      console.error(
        `Icon: rendering not implemented for ${String(strategyToUse)}.`
      );
      return null;
    }

    const rendered = renderToUse({
      ...rest,
      ...optionsRest,
      content: contentToUse,
      className: classNames(
        'rmwc-icon',
        basenameToUse,
        rest.className,
        optionsRest.className,
        iconClassName,
        {
          [`rmwc-icon--size-${size || ''}`]: !!size
        }
      )
    });

    // Unwrap double layered icons...
    if (
      rendered.props.children &&
      rendered.props.children.type &&
      ['Avatar', 'Icon'].includes(rendered.props.children.type.displayName)
github jamesmfriedman / rmwc / src / ripple / index.tsx View on Github external
// This flag really determines a lot
    // is surfaceIsRoot is true, then the surface props are spread
    // to the underlying component, otherwise the only place they
    // can be picked up is by the context consumer
    const surfaceIsRoot = !surface || !unbounded;

    const unboundedProp = unbounded
      ? { 'data-mdc-ripple-is-unbounded': true }
      : {};

    const rippleSurfaceProps = surfaceIsRoot
      ? this.surface.props({ style: child.props.style })
      : {};

    let finalClassNames = classNames(
      className,
      rippleSurfaceProps.className,
      child.props.className,
      {
        'mdc-ripple-surface':
          typeof surface === 'boolean' ? surface : surface === undefined,
        'mdc-ripple-surface--primary': primary,
        'mdc-ripple-surface--accent': accent
      }
    );

    // Fixes a ripple artifact issue
    // that is caused when clicking a button disables it
    // https://codesandbox.io/s/842vo56019
    if (rest.disabled) {
      finalClassNames = finalClassNames.replace(
github jamesmfriedman / rmwc / src / icon / index.tsx View on Github external
}
      )
    });

    // Unwrap double layered icons...
    if (
      rendered.props.children &&
      rendered.props.children.type &&
      ['Avatar', 'Icon'].includes(rendered.props.children.type.displayName)
    ) {
      return React.cloneElement(rendered.props.children, {
        ...rendered.props.children.props,
        ...rendered.props,
        // prevents an infinite loop
        children: rendered.props.children.props.children,
        className: classNames(
          rendered.props.className,
          rendered.props.children.props.className
        )
      });
    }

    return rendered;
  }
);
github jamesmfriedman / rmwc / src / icon / index.tsx View on Github external
const renderUrl = ({ content, ...rest }: { content: string }) => (
  
);
github jamesmfriedman / rmwc / src / tabs / tab-indicator.tsx View on Github external
render() {
    const { icon, transition } = this.props;
    const Tag = !!icon ? Icon : 'span';

    return (
      <span>
        
      </span>
    );
  }
github jamesmfriedman / rmwc / src / tooltip / index.tsx View on Github external
} = {
    ...providerContext.tooltip,
    ...rest
  };

  return (
    
      {children}
    
  );
});
github jamesmfriedman / rmwc / src / switch / index.tsx View on Github external
({ className, ...rest }: { className?: string }) =&gt; (
    <div>
  )
);</div>
github jamesmfriedman / rmwc / src / list / collapsible-list.tsx View on Github external
children,
      handle,
      onOpen,
      onClose,
      open: openProp,
      startOpen,
      ...rest
    } = this.props;
    const { open, childrenStyle } = this.state;

    return (
       (this.root = el)}
        className={classNames('rmwc-collapsible-list', {
          ['rmwc-collapsible-list--open']: open
        })}
      &gt;
        <div>
          {React.cloneElement(handle, {
            ...handle.props,
            onClick: this.handleClick,
            onKeyDown: this.handleKeydown
          })}
        </div>
        <div style="{childrenStyle}">
          <div> (this.childContainer = el)}
          &gt;
            {children}</div></div>
github jamesmfriedman / rmwc / src / list / list-item.tsx View on Github external
render: (props, ref, Tag) =&gt; {
    if (!!props.icon) {
      return ;
    }

    if (React.isValidElement(props.children)) {
      const { children, ...rest } = props;
      return React.cloneElement(props.children, {
        ...rest,
        ...props.children.props,
        className: classNames(props.className, props.children.props.className)
      });
    }

    return ;
  }
});