Add @carbon/layout

This commit is contained in:
Vince Picone
2019-02-07 09:45:58 -06:00
parent 0b417416fe
commit a336ba83ae
4 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import {
rem,
em,
px,
breakpoint,
breakpoints,
breakpointDown,
breakpointUp,
baseFontSize
} from "@carbon/layout";
const firstBreakpoint = Object.keys(breakpoints)[0];
rem(baseFontSize); // $ExpectType string
em(baseFontSize); // $ExpectType string
px(baseFontSize); // $ExpectType string
breakpoint(firstBreakpoint); // $ExpectType string
breakpointUp(firstBreakpoint); // $ExpectType string
breakpointDown(firstBreakpoint); // $ExpectType string

80
types/carbon__layout/index.d.ts vendored Normal file
View File

@@ -0,0 +1,80 @@
// Type definitions for @carbon/layout 0.0
// Project: https://github.com/IBM/carbon-elements/tree/master/packages/layout
// Definitions by: Vince Picone <https://github.com/vpicone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export const baseFontSize: number;
export const breakpoints: {
lg: {
columns: number;
margin: string;
width: string;
};
max: {
columns: number;
margin: string;
width: string;
};
md: {
columns: number;
margin: string;
width: string;
};
sm: {
columns: number;
margin: string;
width: string;
};
xlg: {
columns: number;
margin: string;
width: string;
};
};
export const miniUnit: number;
export const spacing: number[];
export function breakpoint(...args: any[]): string;
export function breakpointDown(name: string): string;
export function breakpointUp(name: string): string;
export function em(px: number): string;
export function miniUnits(count: number): string;
export function px(value: number): string;
export function rem(px: number): string;
export namespace breakpoint {
const prototype: {};
}
export namespace breakpointDown {
const prototype: {};
}
export namespace breakpointUp {
const prototype: {};
}
export namespace em {
const prototype: {};
}
export namespace miniUnits {
const prototype: {};
}
export namespace px {
const prototype: {};
}
export namespace rem {
const prototype: {};
}

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@carbon/layout": ["carbon__layout"]
}
},
"files": ["index.d.ts", "carbon__layout-tests.ts"]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }