How to use the styletron-react.styled function in styletron-react

To help you get started, we’ve selected a few styletron-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 styletron / styletron / packages / flow-type-tests / inferred-deep-composition.js View on Github external
// @flow

import * as React from "react";
import {styled, withStyle, withWrapper} from "styletron-react";

// Note: explicit generic annotation is here because this is not inferred correctly
const Foo = styled<{foo: "foo"}>("div", (_props: {foo: "foo"}) => ({
  color: "red",
}));

// $FlowFixMe
; // Missing foo

// $FlowFixMe
; // Wrong foo

;

const Bar = withStyle(Foo, (_props: {bar: "bar"}) => ({color: "red"}));

// $FlowFixMe
; // Missing foo
// $FlowFixMe
github styletron / styletron / packages / flow-type-tests / with-wrapper-typed.js View on Github external
// @flow

import * as React from "react";
import {styled, withStyle, withWrapper} from "styletron-react";

const Foo = styled("div", (props: {foo: "foo"}) => ({
  color: props.foo,
}));
const Bar = withWrapper(
  Foo,
  StyledComponent => (props: {foo: "foo", bar: "bar"}) => (
    <div>
      
    </div>
  ),
);

// $FlowFixMe
; // missing foo and bar

// $FlowFixMe
; // missing bar
github styletron / styletron / packages / flow-type-tests / with-wrapper.js View on Github external
// @flow

import * as React from "react";
import {styled, withWrapper} from "styletron-react";

const Foo = styled("div", {color: "red"});
const Bar = withWrapper(Foo, StyledComponent =&gt; props =&gt; (
  <div>
    
  </div>
));

;
github uber / baseweb / src / checkbox / examples.js View on Github external
StatefulCheckbox as Checkbox,
  StyledRoot,
  StyledLabel,
  StyledCheckmark,
  StyledInput,
  Checkbox as StatelessCheckbox,
} from './index.js';

import examples from './examples-list.js';

const onChange = e => {
  // eslint-disable-next-line no-console
  console.log('Checked:', e.target.checked);
};

const Icon = styled('span', () => {
  return {
    display: 'flex',
    alignItems: 'center',
    ':before': {
      content: '"Click to focus on checkbox"',
      display: 'inline-block',
      boxSizing: 'border-box',
      verticalAlign: 'middle',
      borderRadius: '2px',
      borderWidth: '2px',
      borderStyle: 'solid',
      borderColor: 'black',
      backgroundColor: 'lightblue',
    },
  };
});
github rtsao / www / src / components / DOM.js View on Github external
export const h2 = styled("h2", {
  fontFamily: "soleil, sans-serif",
  fontStyle: "normal",
  fontSize: "28px",
  "-webkit-font-smoothing": "subpixel-antialiased",
});

export const h3 = styled("h3", {
  fontFamily: "soleil, sans-serif",
  fontStyle: "normal",
  fontSize: "20px",
  fontWeight: 600,
  "-webkit-font-smoothing": "subpixel-antialiased",
});

export const sup = styled("sup", {
  marginLeft: ".2em",
  marginRight: ".1em",
  position: "relative",
  top: "-0.4em",
  verticalAlign: "baseline",
  // fontFamily: 'soleil, sans-serif',
  // fontStyle: 'normal',
  // fontSize: '30px',
  // width: '40px',
  // fontWeight: 600,
  // '-webkit-font-smoothing': 'subpixel-antialiased'
});

export const a = styled("a", {
  textDecoration: "none",
  borderBottom: "2px solid #CFF3FF",
github necolas / react-native-web / packages / benchmarks / src / implementations / styletron-react / View.js View on Github external
/* eslint-disable react/prop-types */
import { styled } from 'styletron-react';

const View = styled('div', ({ style }) => ({
  ...viewStyle,
  style
}));

const viewStyle = {
  alignItems: 'stretch',
  borderWidth: '0px',
  borderStyle: 'solid',
  boxSizing: 'border-box',
  display: 'flex',
  flexBasis: 'auto',
  flexDirection: 'column',
  flexShrink: '0',
  margin: '0px',
  padding: '0px',
  position: 'relative',
github fusionjs / fusionjs.github.io / src / pages / index.js View on Github external
':hover': {
    backgroundColor: 'black',
    borderColor: 'black',
    textDecoration: 'none',
  },
  backgroundColor: blueColor,
  border: `1px solid ${blueColor}`,
  color: 'white',
  cursor: 'pointer',
  display: 'inline-block',
  marginRight: '20px',
  minWidth: '140px',
  padding: '10px 0px',
});

const CTASecondaryButton = styled(OutboundLink, {
  ':hover': {
    borderColor: 'black',
    color: 'black',
    textDecoration: 'none',
  },
  backgroundColor: 'white',
  border: `1px solid ${blueColor}`,
  color: blueColor,
  cursor: 'pointer',
  display: 'inline-block',
  minWidth: '140px',
  padding: '10px 0px',
});

const HomeLayout = styled('div', {
  '@media (max-width: 800px)': {
github fusionjs / fusionjs.github.io / src / components / footer.js View on Github external
color: styleProps.hasSideNav ? '#999' : '#FFF',
  fontSize: '12px',
  ...styleProps.overrides,
}));

const ExternalLink = styled(OutboundLink, {
  backgroundColor: 'transparent',
  color: 'inherit',
  textDecoration: 'none',
});

const InternalLink = props =&gt; {
  return ;
};

const LinkText = styled('span', ({styleProps = {}}) =&gt; ({
  color: styleProps.hasSideNav ? '#999' : '#FFF',
  textTransform: 'uppercase',
  ':hover': {
    textDecoration: 'underline',
  },
}));

export default ({styleProps = {}}) =&gt; {
  return (
    <footer>
      
        </footer>
github joeshub / css-in-react / 15-styletron / src / LikeButton.js View on Github external
display: 'inline-block',
    textAlign: 'center',
    fontSize: props.fontSize || 14,
    fontFamily: 'arial',
    padding: '6px 12px',
    border: 0,
    cursor: 'pointer',
    color: THEME.textColor,
    backgroundColor: THEME.buttonColor,
    ':hover': {
      backgroundColor: THEME.buttonColorHover
    }
  }
})

const Badge = styled('span', (props) => {
  return {
    display: 'inline-block',
    textAlign: 'center',
    fontSize: 12,
    fontWeight: 700,
    borderRadius: '10px',
    padding: '3px 6px',
    position: 'relative',
    top: -1,
    color: THEME.buttonColorHover,
    backgroundColor: THEME.textColor
  }
})

class LikeButton extends Component {
  render () {

styletron-react

React bindings for Styletron

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis

Similar packages