@coko/client
Version:
Client side common code for coko apps
43 lines (42 loc) • 1.18 kB
TypeScript
import { DefaultTheme, Interpolation } from 'styled-components';
type StyledProps = {
theme: DefaultTheme;
};
export type ThemeValue = Interpolation<object>;
/**
* Returns multiples of gridUnit.
*
* It lets you replace statements like this:
* calc(${th('gridUnit')} * 4)
* to this:
* ${grid(4)}
*
*/
declare const grid: (value: number) => (props: StyledProps) => string;
/**
* A bit of syntactic sugar for styled-components. Lets you replace this:
*
* ${props => props.theme.colorPrimary}
*
* with this:
*
* ${th('colorPrimary')}
*
* This is called 'th' (theme helper) for historic reasons
*/
declare const th: (name: string) => (props: StyledProps) => ThemeValue;
/**
* returns color from theme object, based on validation status
*/
type ValidationStatus = 'error' | 'success' | 'default' | 'warning';
type ValidationColorProps = {
theme: {
colorError: string;
colorSuccess: string;
colorBorder: string;
colorWarning: string;
};
validationStatus?: ValidationStatus;
};
declare const validationColor: ({ theme, validationStatus, }: ValidationColorProps) => string;
export { grid, th, validationColor };