How to use react-md - 10 common examples

To help you get started, we’ve selected a few react-md 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 / ibex-dashboard / client / src / components / Card / Settings / Settings.tsx View on Github external
let query = '';

    let mode = 'text';

    let dataActions = null;
    let queryActions = null;

    if (exportData && exportData.length > 0) {
      const options = exportData.map(item => item.id);
      const selectedValue = options[selectedIndex];
      actions = options.length > 1 ? [
        (
           SettingsActions.selectIndex(index)}
            tabIndex={-1}
            toolbar
          />
        )
      ] : <button style="{{" label="{selectedValue}" disabled="">;

      const selected: IExportData = exportData[selectedIndex];

      // data
      const data = selected.data;
      switch (typeof data) {
        case 'object':
          json = data ? JSON.stringify(data, null, 2) : 'null';</button>
github zeit / next.js / examples / with-react-md / pages / index.js View on Github external
src={avatarSrc}
    role="presentation"
    iconSized
    style={{
      alignSelf: 'center',
      marginLeft: 16,
      marginRight: 16,
      flexShrink: 0,
    }}
  /&gt;,
  ,
]

class NavigationLink extends PureComponent {
  // NOTE: Don't try using Stateless (function) component here. `ref` is
  // required by React-MD/AccessibleFakeButton, but Stateless components
  // don't have one by design:
  // https://github.com/facebook/react/issues/4936
  render() {
    const { href, as, children, ..._props } = this.props
    return (
      <div style="{{">
        
          </div>
github webdevstar / Dashborad / src / components / generic / TextFilter.tsx View on Github external
render() {
    var { selectedValue, values } = this.state;
    values = values || [];

    // var buttons = values.map((value, idx) =&gt; {
    //   return <button label="{value}">
    // })

    return (
        
    );
  }
}</button>
github Azure / ibex-dashboard / client / src / components / Tooltip / TooltipFontIcon.tsx View on Github external
import * as React from 'react';
import FontIcon from 'react-md/lib/FontIcons';
import injectTooltip from 'react-md/lib/Tooltips';

// Material icons shouldn't have any other children other than the child string and
// it gets converted into a span if the tooltip is added, so we add a container
// around the two.
const TooltipFontIcon = injectTooltip(({
  children, iconClassName, className, tooltip, forceIconFontSize, forceIconSize, style, iconStyle, ...props }) =&gt; (

  <div style="{style}">
    {tooltip}
    
      {children}
    
  </div>
));

TooltipFontIcon.propTypes = {
github mlaursen / react-md / docs / src / shared / components / ReactMD / tooltips / TooltipFontIcon.jsx View on Github external
import React, { PropTypes } from 'react';
import classnames from 'classnames';
import FontIcon from 'react-md/lib/FontIcons';
import injectTooltip from 'react-md/lib/Tooltips';

// Material icons shouldn't have any other children other than the child string and
// it gets converted into a span if the tooltip is added, so we add a container
// around the two.
const TooltipFontIcon = injectTooltip(({ children, iconClassName, className, tooltip, ...props }) =&gt; (
  <div>
    {tooltip}
    {children}
  </div>
));

TooltipFontIcon.propTypes = {
  children: PropTypes.string.isRequired,
  className: PropTypes.string,
  iconClassName: PropTypes.string,
  tooltip: PropTypes.node,
};

export default TooltipFontIcon;
github mlaursen / react-md / docs / src / examples / tooltips / TooltipFontIcon.jsx View on Github external
import React, { PropTypes } from 'react';
import classnames from 'classnames';
import FontIcon from 'react-md/lib/FontIcons';
import injectTooltip from 'react-md/lib/Tooltips';

// Material icons shouldn't have any other children other than the child string and
// it gets converted into a span if the tooltip is added, so we add a container
// around the two.
const TooltipFontIcon = injectTooltip(({ children, iconClassName, className, ...props }) =&gt; (
  <div>
    {children}
  </div>
));

TooltipFontIcon.propTypes = {
  children: PropTypes.string.isRequired,
  className: PropTypes.string,
  iconClassName: PropTypes.string,
};

export default TooltipFontIcon;
github mlaursen / react-md / docs / src / examples / autocompletes / MenuAutocomplete.jsx View on Github external
_handleFilterChange = (value) => {
    let filterType;
    switch (value) { // eslint-disable-line default-case
      case 'case':
        filterType = Autocomplete.caseInsensitiveFilter;
        break;
      case 'fuzzy':
        filterType = Autocomplete.fuzzyFilter;
        break;
      case 'fuse':
        filterType = this._fuseJSFilter;
        break;
    }

    this.setState({ filterType });
  };
github mlaursen / react-md / docs / src / app / components / NavigationDrawers / NavigationDrawerExamples.jsx View on Github external
import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import { Link } from 'react-router';

import { RadioGroup, Radio } from 'react-md/lib/SelectionControls';
import FontIcon from 'react-md/lib/FontIcons';
import NavigationDrawer from 'react-md/lib/NavigationDrawers';
const { FULL_HEIGHT, CLIPPED, FLOATING, PERSISTENT, PERSISTENT_MINI, TEMPORARY, TEMPORARY_MINI } = NavigationDrawer.DrawerType;

// amazing way to keep state between routes
let state = {
  isOpen: false,
  drawerType: FULL_HEIGHT,
};

const LOCATION = '/components/navigation-drawers';

export default class NavigationDrawerExamples extends Component {
  constructor(props) {
    super(props);

    this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
    this.state = state;
  }
github mlaursen / react-md / documentation / src / shared / components / snackbars / InteractiveExample.jsx View on Github external
_addToast() {
    const { text, action } = this.state;
    const toasts = this.state.toasts.slice();
    toasts.push({ text, action });

    const words = text.split(' ').length;
    const autohideTimeout = Math.max(
      Snackbar.defaultProps.autohideTimeout,
      (words / AVERAGE_WPS) * 1000
    );

    this.setState({ toasts, autohideTimeout });
  }
github mlaursen / react-md / documentation / src / shared / components / navigation-drawers / ControlReactMDDrawer.jsx View on Github external
import React, { PureComponent, PropTypes } from 'react';
import { connect } from 'react-redux';
import SelectField from 'react-md/lib/SelectFields';
import { updateDrawerType } from 'actions/ui';

import Drawer from 'react-md/lib/Drawers';
import { isPermanent, isPersistent } from 'react-md/lib/Drawers/isType';
const types = Object.keys(Drawer.DrawerTypes).map(key => Drawer.DrawerTypes[key]);

@connect(({ ui: { drawer: { mobile, tablet } } }) => ({ mobile, tablet }), { updateDrawerType })
export default class ControlReactMDDrawer extends PureComponent {
  static propTypes = {
    mobile: PropTypes.bool.isRequired,
    tablet: PropTypes.bool.isRequired,
    updateDrawerType: PropTypes.func.isRequired,
    className: PropTypes.string,
    children: PropTypes.node,
  };

  componentWillUnmount() {
    this.props.updateDrawerType(undefined);
  }

  render() {