Skip to content

Instantly share code, notes, and snippets.

@g-a-v-i-n
Created August 11, 2020 18:48
Show Gist options
  • Save g-a-v-i-n/361920a66ccf4bd7a26a13a2e587e610 to your computer and use it in GitHub Desktop.
Save g-a-v-i-n/361920a66ccf4bd7a26a13a2e587e610 to your computer and use it in GitHub Desktop.
import * as React from 'react'
import styled from "styled-components";
import css, { SystemStyleObject } from "@styled-system/css";
import {
border,
BorderProps,
color,
ColorProps,
flexbox,
FlexboxProps,
layout,
LayoutProps,
position,
PositionProps,
space,
SpaceProps,
} from "styled-system";
import { IndigoSystemStyleProp } from "./tokens";
type Props = React.HTMLProps<HTMLDivElement> &
BorderProps &
ColorProps &
FlexboxProps &
LayoutProps &
PositionProps &
SpaceProps & {
pitch?: IndigoSystemStyleProp;
};
const Row: React.FunctionComponent<Props> = styled.div(
({ pitch }: Props) =>
css({
display: "flex",
flexDirection: "column",
"& > *": typeof pitch === "undefined" ? {} : { marginLeft: pitch },
"& :first-child": typeof pitch === "undefined" ? {} : { marginLeft: 0 },
} as SystemStyleObject),
border,
color,
flexbox,
layout,
position,
space
);
export default Row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment