How to use the office-ui-fabric-react.classNamesFunction function in office-ui-fabric-react

To help you get started, we’ve selected a few office-ui-fabric-react 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 Azure-Samples / azure-intelligent-edge-patterns / edge-ai-void-detection / modules / apiserver / src / RetailDemo.Web.UI / ClientApp / src / layouts / Layout.base.jsx View on Github external
// Sub-components
import Header from "../components/Header/Header.jsx";
import Sidebar from "../components/Sidebar/Sidebar.jsx";
import Footer from "../components/Footer/Footer.jsx";

// routes
import layoutRoutes from "../routes/layoutRoutes.jsx";

//import "react-perfect-scrollbar/dist/css/styles.css"; // TODO: Move into plugins in SASS or .style.jsx

// Import theme overrides
import themeData from "../variables/themeData.jsx";

// function to create classNames for each element with the need of a className
const getClassNames = classNamesFunction();

export const LayoutBase = (props) => {
    const { className, styles, theme } = props;

    //loadTheme(themeData); TODO: To customize OOB theme

    const classNames = getClassNames(styles, { theme, className }); // after className add any other props from IComponentStyleProps example disabled, etc
    const { subComponentStyles } = classNames;

    // Hooks
    //const [styles, setStyles] = useState();

    const getRoutes = routes => {
        return routes.map((prop, key) => {
            // Here we difine any props needed by the component that layout will render
            const dataScope = props.dataScope; //TODO: Get the datascope from the token
github OfficeDev / office-ui-fabric-react / packages / example-app-base / src / components / PlatformBar / PlatformBar.base.tsx View on Github external
import * as React from 'react';
import { classNamesFunction, FocusZone, DefaultButton, Icon, TooltipHost } from 'office-ui-fabric-react';
import { IPlatformBarProps, IPlatformBarStyleProps, IPlatformBarStyles } from './PlatformBar.types';
import { IPlatform } from '../PlatformPicker/index';
import { INavPage } from '../Nav/index';

const getClassNames = classNamesFunction();

export class PlatformBarBase extends React.PureComponent> {
  private _classNames: { [key in keyof IPlatformBarStyles]: string };

  public render(): JSX.Element {
    const { styles, theme, platforms, innerWidth } = this.props;

    this._classNames = getClassNames(styles, {
      theme: theme!,
      innerWidth
    });

    return (
      <div>
        <div>
          {/* Override default role of "presentation" to prevent warning about li outside of ul */}</div></div>
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / ActivityItem / examples / ActivityItem.Persona.Example.tsx View on Github external
interface IActivityItemExampleStyles {
  exampleRoot?: IStyle;
  nameText?: IStyle;
}

const exampleStyles: IActivityItemExampleStyles = {
  exampleRoot: {
    marginTop: '20px'
  },
  nameText: {
    fontWeight: 'bold'
  }
};

const getClassNames = classNamesFunction();
const classNames = getClassNames(exampleStyles, {});

export class ActivityItemPersonaExample extends React.Component, {}&gt; {
  public render(): JSX.Element {
    // tslint:disable:jsx-no-lambda
    const activityItemExamples: (IActivityItemProps &amp; { key: string | number })[] = [
      {
        key: 1,
        activityDescription: [
           {
              alert('A name was clicked.');
            }}
          &gt;
github Azure-Samples / azure-intelligent-edge-patterns / edge-ai-void-detection / modules / apiserver / src / RetailDemo.Web.UI / ClientApp / src / views / Monitoring / Monitoring.jsx View on Github external
import PropTypes from "prop-types";

import { Image, Stack, StackItem, PrimaryButton, Label, Coachmark, DirectionalHint, TeachingBubbleContent, MessageBar, MessageBarType, classNamesFunction } from "office-ui-fabric-react";
import { styled } from "@uifabric/utilities";

// Hooks components
import useInterval from "../../components/Hooks/useInterval.jsx";

// Import sub-components
import { imageEventsContainer } from '../../api/DataContainers/imageEventsContainer';

// Import the components styles
import { getStyles } from "./Monitoring.styles.jsx";

// function to create classNames for each element with the need of a className
const getClassNames = classNamesFunction();

// Process the styles to create the components classNmes
const Monitoring = styled(
    MonitoringBase,
    getStyles,
    undefined,
    {
        scope: "Monitoring"
    }
);



function MonitoringBase(props) {
    const { className, styles, theme } = props;
    const edgeDevice = "retail-onsite-dbe-edge";
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Button / examples / Button.Default.Example.tsx View on Github external
'ms-BasicButtonsTwoUp',
    {
      display: 'flex',
      selectors: {
        '&amp; &gt; *': {
          flexGrow: 1
        },
        '.ms-Label': {
          marginBottom: '10px'
        }
      }
    }
  ]
};

const getClassNames = classNamesFunction();
const classNames = getClassNames(exampleStyles, {});

export class ButtonDefaultExample extends React.Component {
  public render(): JSX.Element {
    const { disabled, checked } = this.props;

    return (
      <div>
        <div>
          <label>Standard</label>
          </div></div>
github OfficeDev / office-ui-fabric-react / packages / example-app-base / src / components / MarkdownTable / MarkdownTable.tsx View on Github external
import * as React from 'react';
import { classNamesFunction, styled } from 'office-ui-fabric-react';
import { IMarkdownTableProps, IMarkdownTableStyleProps, IMarkdownTableStyles } from './MarkdownTable.types';
import { getStyles } from './MarkdownTable.styles';

const getClassNames = classNamesFunction();

export class MarkdownTableBase extends React.PureComponent {
  public render(): JSX.Element {
    const { children, className, styles, theme } = this.props;

    const classNames = getClassNames(styles, {
      theme: theme!,
      className
    });

    return (
      <div>
        
          {children}
        <table></table>
      </div>
github OfficeDev / office-ui-fabric-react / packages / example-app-base / src / components / MarkdownTable / MarkdownTr.tsx View on Github external
import * as React from 'react';
import { classNamesFunction, styled } from 'office-ui-fabric-react';
import { IMarkdownTableProps, IMarkdownTableStyleProps, IMarkdownTableStyles } from './MarkdownTable.types';
import { getStyles } from './MarkdownTable.styles';

const getClassNames = classNamesFunction();

export class MarkdownTrBase extends React.PureComponent {
  public render(): JSX.Element {
    const { children, styles, theme } = this.props;

    const classNames = getClassNames(styles, {
      theme: theme!
    });

    return (
      
        {children}
      
    );
  }
}
github OfficeDev / office-ui-fabric-react / packages / dashboard / src / components / SubwayNav / SubwayNodeBase.tsx View on Github external
import * as React from 'react';
import { getIcon, IIconRecord, classNamesFunction, FocusZone, IProcessedStyleSet } from 'office-ui-fabric-react';
import { ISubwayNavNodeProps, SubwayNavNodeState, ISubwayNavNodeStyleProps, ISubwayNavNodeStyles } from './SubwayNode.types';
import { getIconMap } from './SubwayNode.styles';
import { SubwayNode } from './SubwayNode';

const getClassNames = classNamesFunction();

export class SubwayNodeBase extends React.PureComponent {
  public static defaultProps = {
    state: SubwayNavNodeState.Current,
    isSubStep: false,
    disabled: false
  };

  private _classNames: IProcessedStyleSet;

  public constructor(props: ISubwayNavNodeProps) {
    super(props);
    this._onClickStep = this._onClickStep.bind(this);
  }

  public render(): JSX.Element {
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / src / components / Button / examples / Button.Compound.Example.tsx View on Github external
'ms-BasicButtonsTwoUp',
    {
      display: 'flex',
      selectors: {
        '&amp; &gt; *': {
          flexGrow: 1
        },
        '.ms-Label': {
          marginBottom: '10px'
        }
      }
    }
  ]
};

const getClassNames = classNamesFunction();
const classNames = getClassNames(exampleStyles, {});

export class ButtonCompoundExample extends React.Component {
  public render(): JSX.Element {
    const { disabled, checked } = this.props;

    return (
      <div>
        <div>
          <label>Standard</label>
          
            Create account
          
        </div>
        <div>
          <label>Primary</label></div></div>
github OfficeDev / office-ui-fabric-react / packages / example-app-base / src / components / MarkdownTable / MarkdownTHead.tsx View on Github external
import * as React from 'react';
import { classNamesFunction, styled } from 'office-ui-fabric-react';
import { IMarkdownTableProps, IMarkdownTableStyleProps, IMarkdownTableStyles } from './MarkdownTable.types';
import { getStyles } from './MarkdownTable.styles';

const getClassNames = classNamesFunction();

export class MarkdownTHeadBase extends React.PureComponent {
  public render(): JSX.Element {
    const { children, styles, theme } = this.props;

    const classNames = getClassNames(styles, {
      theme: theme!
    });

    return (
      
        {children}
      
    );
  }
}