How to use the baseui.withStyle function in baseui

To help you get started, we’ve selected a few baseui 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 uber / baseweb / documentation-site / components / sidebar.js View on Github external
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/

/* eslint-disable flowtype/require-valid-file-annotation */

import React from 'react';
import {withStyle} from 'baseui';
import {Navigation, StyledNavItem as NavItem} from 'baseui/side-navigation';
import {Label2, Label3} from 'baseui/typography';
import Link from 'next/link';

import Routes from '../routes';

const StyledNavItem = withStyle(NavItem, ({$theme, $active}) => {
  const styleOverride = {};

  if ($theme.name.startsWith('dark')) {
    if ($active) {
      styleOverride.background = $theme.colors.backgroundSecondary;
    }
  }
  return {
    paddingTop: $theme.sizing.scale200,
    paddingBottom: $theme.sizing.scale200,
    ...styleOverride,
  };
});

const removeSlash = path => {
  if (path) {
github uber / baseweb / documentation-site / examples / spinner / next-custom.tsx View on Github external
import {withStyle} from 'baseui';
import {StyledSpinnerNext} from 'baseui/spinner';

const ExtraLargeSpinner = withStyle(StyledSpinnerNext, {
  width: '96px',
  height: '96px',
  borderWidth: '12px',
  borderTopColor: 'pink',
});

export default ExtraLargeSpinner;
github uber / baseweb / documentation-site / examples / table / fixed-width-column.js View on Github external
31,
    '100 Broadway st. New York City, New York',
  ],
  [
    2,
    'Jane',
    'Smith',
    32,
    '100 Market st. San Francisco, California',
  ],
  [3, 'Joe', 'Black', 33, '100 Macquarie st. Sydney, Australia'],
];

const COLUMNS = ['Id', 'First Name', 'Last Name', 'Age', 'Address'];

const SmallerHeadCell = withStyle(StyledHeadCell, {
  maxWidth: '30px',
});

const SmallerCell = withStyle(StyledCell, {
  maxWidth: '30px',
});

export default () => {
  const [css] = useStyletron();
  return (
    <div>
      
        
          ID
          {COLUMNS.slice(1).map((col, index) =&gt; (
            {col}</div>
github uber / baseweb / documentation-site / examples / table / cells.js View on Github external
import Search from 'baseui/icon/search';
import Plus from 'baseui/icon/plus';
import Delete from 'baseui/icon/delete';
import Overflow from 'baseui/icon/overflow';
import {
  StyledTable,
  StyledHead,
  StyledHeadCell,
  StyledBody,
  StyledRow,
  StyledCell,
  StyledAction,
} from 'baseui/table';
import {Caption1, Caption2, Paragraph3} from 'baseui/typography';

const StyledHeadingCell = withStyle(StyledCell, {
  paddingTop: 0,
  paddingBottom: 0,
});

const StyledDeltaCell: any = withStyle(StyledCell, props => ({
  ...props.$theme.typography.font550,
  alignItems: 'center',
  backgroundColor: props.$isNegative
    ? props.$theme.colors.negative50
    : props.$theme.colors.positive50,
  color: props.$isNegative
    ? props.$theme.colors.negative
    : props.$theme.colors.positive,
}));

const StyledLargeText = withStyle(StyledCell, {
github uber / baseweb / documentation-site / examples / table / cells.tsx View on Github external
Delete,
  Overflow,
} from 'baseui/icon';
import {
  StyledTable,
  StyledHead,
  StyledHeadCell,
  StyledBody,
  StyledRow,
  StyledCell,
  StyledAction,
} from 'baseui/table';
import {Caption1, Caption2, Paragraph3} from 'baseui/typography';
import {Theme} from 'baseui/theme';

const StyledHeadingCell = withStyle(StyledCell, {
  paddingTop: 0,
  paddingBottom: 0,
});

const StyledDeltaCell = withStyle&lt;
  typeof StyledCell,
  {$isNegative: boolean},
  Theme &amp; {customThemeProp: string}
&gt;(StyledCell, ({$isNegative, $theme}) =&gt; ({
  ...$theme.typography.font550,
  alignItems: 'center',
  backgroundColor: $isNegative
    ? $theme.colors.negative50
    : $theme.colors.positive50,
  color: $isNegative
    ? $theme.colors.negative
github uber / baseweb / documentation-site / pages / index.js View on Github external
import {Button} from 'baseui/button';
import {FlexGrid, FlexGridItem} from 'baseui/flex-grid';
import {StyledLink as Link} from 'baseui/link';
import {H1, H2} from '../components/markdown-elements';
import {Card, StyledBody} from 'baseui/card';
import {Tag} from 'baseui/tag';
import fetch from 'isomorphic-fetch';
import {withStyle} from 'baseui';

import BlogPosts from '../posts.js';

import Layout from '../components/layout';
import Contributors from '../components/contributors';
import Markdown from '../components/markdown-elements';

const MinHeightBody = withStyle(StyledBody, {
  minHeight: '150px',
});

type Contributor = {
  avatar_url: string,
  html_url: string,
  login: string,
  type: 'Bot' | 'User',
};

const cardOverrides = {
  Root: {
    style: ({$theme}) => ({
      marginLeft: $theme.sizing.scale600,
      marginRight: $theme.sizing.scale600,
      marginTop: $theme.sizing.scale500,
github uber / baseweb / documentation-site / components / walkthrough.js View on Github external
display: 'block',
          },
        })}
      &gt;
        
          <span aria-label="open announcement modal" role="img">
            🎁
          </span>
        
      
    
  );
};
const MinHeightBody = withStyle(ModalBody, {
  minHeight: '350px',
});
const Content = [
  () =&gt; {
    return (
      
        
          We are happy to announce a new, interactive API documentation for Base
          Web!
        
        
          We have removed the old, auto-generated API documentation from the
          site, in favour of a new, interactive documentation, that writes code
          for you!
github uber / baseweb / documentation-site / examples / table / cells.tsx View on Github external
const StyledDeltaCell = withStyle&lt;
  typeof StyledCell,
  {$isNegative: boolean},
  Theme &amp; {customThemeProp: string}
&gt;(StyledCell, ({$isNegative, $theme}) =&gt; ({
  ...$theme.typography.font550,
  alignItems: 'center',
  backgroundColor: $isNegative
    ? $theme.colors.negative50
    : $theme.colors.positive50,
  color: $isNegative
    ? $theme.colors.negative
    : $theme.colors.positive,
}));

const StyledLargeText = withStyle(StyledCell, {
  alignItems: 'center',
});

const DATA = [
  [
    'Marlyn',
    'Engineering',
    'San Francisco',
    -100,
    1234.5,
    {
      title: 'New York',
      data: '100 Broadway st. New York City, New York',
    },
  ],
  [
github uber / baseweb / documentation-site / examples / table / cells.js View on Github external
paddingTop: 0,
  paddingBottom: 0,
});

const StyledDeltaCell: any = withStyle(StyledCell, props => ({
  ...props.$theme.typography.font550,
  alignItems: 'center',
  backgroundColor: props.$isNegative
    ? props.$theme.colors.negative50
    : props.$theme.colors.positive50,
  color: props.$isNegative
    ? props.$theme.colors.negative
    : props.$theme.colors.positive,
}));

const StyledLargeText = withStyle(StyledCell, {
  alignItems: 'center',
});

const DATA = [
  [
    'Marlyn',
    'Engineering',
    'San Francisco',
    -100,
    1234.5,
    {
      title: 'New York',
      data: '100 Broadway st. New York City, New York',
    },
  ],
  [
github uber / baseweb / documentation-site / examples / menu / virtual-list.tsx View on Github external
import React from 'react';
import {withStyle} from 'baseui';
import {StatefulMenu, OptionList, StyledList} from 'baseui/menu';
import {List, AutoSizer} from 'react-virtualized';

const ITEMS = [...new Array(1500)].map((_, index) =&gt; ({
  label: `item number: ${index + 1}`,
}));

const Container = withStyle(StyledList, {height: '500px'});

const VirtualList = React.forwardRef((props: any, ref) =&gt; {
  const children = React.Children.toArray(props.children);
  return (
    
      
        {({width}) =&gt; (
           (