Skip to content

Commit

Permalink
feat: add typescript definitions (#54)
Browse files Browse the repository at this point in the history
Add TypeScript definition file
  • Loading branch information
nickduncan7 authored and azz committed Dec 17, 2018
1 parent 154bf5e commit cf43d8b
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Type definitions for styled-css-grid
// Project: https://github.com/azz/styled-css-grid
// Definitions by: protocol114 <https://github.com/protocol114>

declare module 'styled-css-grid' {
import * as React from "react";
import {StyledComponent} from "styled-components";

export interface ICellProps extends React.ComponentPropsWithRef<'div'> {
className?: string,
width?: number,
height?: number,
top?: number | string,
left?: number | string,
middle?: boolean,
center?: boolean,
area?: string
}

export interface IGridProps extends React.ComponentPropsWithRef<'div'> {
className?: string,
columns?: number | string,
gap?: string,
columnGap?: string,
rowGap?: string,
height?: string,
minRowHeight?: string,
flow?: string,
rows?: number | string,
areas?: string[],
justifyContent?: string,
alignContent?: string
}

export type GridComponent = StyledComponent<
React.ForwardRefExoticComponent<Partial<IGridProps>>,
any
>;

export type CellComponent = StyledComponent<
React.ForwardRefExoticComponent<Partial<ICellProps>>,
any
>;

export const Grid: GridComponent;
export const Cell: CellComponent;
}

0 comments on commit cf43d8b

Please sign in to comment.