0.8.1 • Published 3 years ago

@codecademy/gamut-system v0.8.1

Weekly downloads
3,713
License
MIT
Repository
github
Last release
3 years ago

Gamut System

Style props for building robustly typed design systems in react.

Features

  • Completely customizable style props (with theme agnostic implementation);
  • Flexible props that are both responsive and composable.
  • Strict design system aware types with no manual fuss.
  • Works with emotion and styled-components in preferred syntax.

Docs

Checkout each section

Usage

Create your new system locally to your app:

import { system, HandlerProps } from '@codecademy/gamut-system';

export const {
  propGroups: { typography, spacing, layout },
} = system.create({});

export type TypographyProps = HandlerProps<typeof typography>;
export type SpacingProps = HandlerProps<typeof spacing>;
export type LayoutProps = HandlerProps<typeof layout>;

In your components:

import styled from '@emotion/styled';
import {
  typography,
  spacing,
  layout,
  TypographyProps,
  SpacingProps,
  LayoutProps,
} from '../system';

export type BoxProps = TypographyProps & SpacingProps & LayoutProps;

export const Box = styled<BoxProps>`
  ${typography}
  ${spacing}
  ${layout}
`;

Regular Props

<Box margin="1rem" />

<Box fontSize="2rem" />

<Box width={1 / 5} />

Responsive Props

// Array Syntax
<Box width={[50, 100, 200]} />

// Object syntax
<Box margin={{ xs: 16, sm: 24, md: 32 }} />
0.8.1

3 years ago

0.8.0

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

4 years ago