How to use astroturf - 10 common examples

To help you get started, we’ve selected a few astroturf 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 4Catalyzer / astroturf / test / fixtures / pass-options.js View on Github external
import styled from 'astroturf';

const SIZE = 75;

// prettier-ignore
const FancyBox = styled('div', { someOption: true })`
  color: red;
  width: ${SIZE}px;

  @media (min-width: 420px) {
    width: 96px;
    height: 96px;
  }

  &.primary {
    background: white;
    color: palevioletred;
  }
`;

const options = {};
github 4Catalyzer / astroturf / test / integration / main.js View on Github external
}
`;

const FancyBox = styled('div')`
  composes: foo from global;

  color: red;
  width: ${width}px;

  &.primary {
    background: white;
    color: palevioletred;
  }
`;

const FancierBox = styled('div')`
  color: ultra-red;

  > ${FancyBox} {
    padding: 4em;
  }

  ${styles.parent} > & {
    margin: 2em;
  }

  /* these are the same selector */
  & > ${Button} {
    margin-left: 4px;
  }
  & > ${Buttons.Button} {
    margin-left: 8px;
github 4Catalyzer / astroturf / test / fixtures / multiple-components.js View on Github external
import styled, { css } from 'astroturf';

const SIZE = 75;

// prettier-ignore
const FancyBox = styled('div')`
  color: red;
  width: ${SIZE}px;

  @media (min-width: 420px) {
		width: 96px;
		height: 96px;
	}

  &.primary {
    background: white;
    color: palevioletred;
  }
`;

const FancyHeader = styled('h2')`
  color: red;
github 4Catalyzer / astroturf / test / __file_snapshots__ / loader__typescript.tsx View on Github external
const SIZE = 75;

const styles = require("./typescript-styles.css");

interface PropsType {
  children: JSX.Element;
  name: string;
}

function someMath(obj: T): T {
  console.log(Math.abs(obj.x));
  return obj as T;
}

const Button = /*#__PURE__*/ styled("button", null, {
  displayName: "Button",
  styles: require("./typescript-Button.css"),
  attrs: null,
  vars: []
});

class Component extends React.Component {
  render() {
    return (
      <>
        <h2>{this.props.children}</h2>
        <button>
          click</button>
github 4Catalyzer / astroturf / test / fixtures / display-name.js View on Github external
import styled from 'astroturf';

const Foo = () => {};
const bar = 'Bar';
Foo[bar]['baz'] = styled('div')`
  color: red;
`;

export default styled(FancyBox)`
  color: ultra-red;
`;
github 4Catalyzer / astroturf / test / fixtures / styled-interpolations.js View on Github external
&.primary {
    background: white;
    color: palevioletred;
  }
`;

const FancierBox = styled('div')`
  color: ultra-red;

  > ${FancyBox} {
    padding: 4em;
  }
`;

const Button = styled(Button)`
  composes: button-with-caret from global;
`;
github 4Catalyzer / astroturf / test / __file_snapshots__ / loader__with-props.js View on Github external
import { styled } from "astroturf";

const RedPasswordInput = /*#__PURE__*/ styled("input", null, {
  displayName: "RedPasswordInput",
  styles: require("./with-props-RedPasswordInput.css"),
  attrs: props => ({ ...props, type: "password" }),
  vars: []
});

const RedPasswordInput2 = /*#__PURE__*/ styled("input", null, {
  displayName: "RedPasswordInput2",
  styles: require("./with-props-RedPasswordInput2.css"),
  attrs: p => ({
    type: "password"
  }),
  vars: []
});
github 4Catalyzer / astroturf / test / fixtures / with-props.js View on Github external
import { styled } from 'astroturf';

const RedPasswordInput = styled('input').attrs({ type: 'password' })`
  background-color: red;
`;

const RedPasswordInput2 = styled('input').attrs(p => ({
  type: 'password',
}))`
  background-color: red;
`;
github 4Catalyzer / astroturf / test / fixtures / hoist-import.js View on Github external
import { styled } from 'astroturf';

const ButtonBase = styled('button')`
  @import '~./styles/mixins.scss';

  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
`;
github 4Catalyzer / astroturf / test / fixtures / with-props.js View on Github external
import { styled } from 'astroturf';

const RedPasswordInput = styled('input').attrs({ type: 'password' })`
  background-color: red;
`;

const RedPasswordInput2 = styled('input').attrs(p => ({
  type: 'password',
}))`
  background-color: red;
`;

astroturf

Extract and process inline CSS literals in JavaScript files

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis