How to use @patternfly/react-styles - 10 common examples

To help you get started, we’ve selected a few @patternfly/react-styles 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 patternfly / patternfly-react / packages / patternfly-4 / react-table / src / components / Table / utils / decorators / compoundExpand.tsx View on Github external
const {
    extraParams: { onExpand }
  } = column;
  const extraData = {
    rowIndex,
    columnIndex,
    column,
    property
  };

  function onToggle(event: React.MouseEvent) {
    // tslint:disable-next-line:no-unused-expression
    onExpand && onExpand(event, rowIndex, columnIndex, props.isOpen, rowData, extraData);
  }
  return {
    className: css(styles.tableCompoundExpansionToggle, props.isOpen && styles.modifiers.expanded),
    children: props.isOpen !== undefined && (
      <button aria-controls="{props.ariaControls}" aria-expanded="{props.isOpen}">
        {title}
      </button>
    )
  };
};
github patternfly / patternfly-react / packages / patternfly-4 / react-table / src / components / Table / utils / decorators / classNames.ts View on Github external
import { css, pickProperties } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Table/table';
import { ITransform } from '../../Table';

export const Visibility = pickProperties(styles.modifiers, [
  'hidden',
  'hiddenOnSm',
  'hiddenOnMd',
  'hiddenOnLg',
  'hiddenOnXl',
  'hiddenOn_2xl',
  'visibleOnSm',
  'visibleOnMd',
  'visibleOnLg',
  'visibleOnXl',
  'visibleOn_2xl'
]);

// tslint:disable-next-line:no-shadowed-variable
export const classNames = (...classNames: string[]): ITransform => () => ({
  className: css(...classNames)
github patternfly / patternfly-react / packages / patternfly-4 / react-table / src / components / Table / utils / decorators / sortable.tsx View on Github external
} else {
      reversedDirection = sortBy.direction === SortByDirection.asc ? SortByDirection.desc : SortByDirection.asc;
    }
    // tslint:disable-next-line:no-unused-expression
    onSort &amp;&amp; onSort(event, columnIndex, reversedDirection, extraData);
  }

  return {
    className: css(styles.tableSort, isSortedBy &amp;&amp; styles.modifiers.selected),
    'aria-sort': isSortedBy ? `${sortBy.direction}ending` : 'none',
    children: (
      
        {label}
      
    )
  };
};
github patternfly / patternfly-react / packages / patternfly-4 / react-core / src / components / Dropdown / Dropdown.tsx View on Github external
export const Dropdown: React.FunctionComponent = ({
  onSelect,
  ref, // Types of Ref are different for React.FC vs React.Component
  ...props
}: DropdownProps) =&gt; (
   onSelect &amp;&amp; onSelect(event),
      toggleTextClass: styles.dropdownToggleText,
      toggleIconClass: styles.dropdownToggleIcon,
      menuClass: styles.dropdownMenu,
      itemClass: styles.dropdownMenuItem,
      toggleClass: styles.dropdownToggle,
      baseClass: styles.dropdown,
      baseComponent: 'div',
      sectionClass: styles.dropdownGroup,
      sectionTitleClass: styles.dropdownGroupTitle,
      sectionComponent: 'section',
      disabledClass: styles.modifiers.disabled,
      hoverClass: styles.modifiers.hover,
      separatorClass: styles.dropdownSeparator
    }}
  &gt;
    
  
);
github patternfly / patternfly-react / packages / react-core / src / components / Alert / AlertIcon.js View on Github external
const AlertIcon = ({ variant, className, ...props }) =&gt; {
  const Icon = variantIcons[variant];
  return (
    <div>
      
    </div>
  );
};
github patternfly / patternfly-react / packages / patternfly-4 / react-core / src / components / Alert / Alert.js View on Github external
...props
}) =&gt; {
  variantLabel = variantLabel || capitalize(AlertVariant[variant]);
  const readerTitle = (
    
      <span>{`${variantLabel} alert:`}</span>
      {title}
    
  );

  const customClassName = css(styles.alert, getModifier(styles, variant, styles.modifiers.info), className);

  return (
    <div aria-label="{ariaLabel}">
      
      <h4>{readerTitle}</h4>
      {children &amp;&amp; (
        <div>
          <p>{children}</p>
        </div>
      )}
      {action &amp;&amp; (
        <div>{React.cloneElement(action, { title, variantLabel })}</div>
      )}
    </div>
  );
};
github patternfly / patternfly-react / packages / patternfly-4 / react-table / src / components / Table / BodyCell.tsx View on Github external
colSpan,
  component = 'td',
  isVisible,
  parentId,
  textCenter = false,
  isOpen,
  ariaControls = '',
  ...props
}: BodyCellProps) =&gt; {
  const Component = component as any;
  const mappedProps = {
    ...(dataLabel ? { 'data-label': dataLabel } : {}),
    ...props
  };
  return (parentId !== undefined &amp;&amp; colSpan === undefined) || !isVisible ? null : (
    
  );
};
github patternfly / patternfly-react / packages / patternfly-4 / react-core / src / components / LoginPage / LoginMainFooterBandItem.tsx View on Github external
export const LoginMainFooterBandItem: React.FunctionComponent = ({
  children = null,
  className = '',
  ...props
}: LoginMainFooterBandItemProps) =&gt; (
  <p>
    {children}
  </p>
);
github patternfly / patternfly-react / packages / patternfly-4 / react-core / src / components / Select / CheckboxSelect.js View on Github external
render() {
    const { children, className, isExpanded, checked, isGrouped, ...props } = this.props;
    this.renderedChildren = this.extendChildren(props);
    return (
      
        <div>
          <form novalidate="">
            <div>{this.renderedChildren}</div>
          </form>
        </div>
      
    );
  }
}
github patternfly / patternfly-react / packages / patternfly-4 / react-core / src / components / AboutModal / AboutModalBoxContent.tsx View on Github external
export const AboutModalBoxContent: React.SFC = ({
  children,
  className = '',
  trademark,
  id,
  noAboutModalBoxContentContainer = false,
  ...props
}: AboutModalBoxContentProps) =&gt; (
  <div id="{id}">
    <div>
      {noAboutModalBoxContentContainer ? children : <div>{children}</div>}
    </div>
    <p>{trademark}</p>
  </div>
);