redoc/src/styled-components.ts

27 lines
750 B
TypeScript
Raw Normal View History

2017-10-12 00:01:37 +03:00
import * as styledComponents from 'styled-components';
import { ThemedStyledComponentsModule } from 'styled-components';
import { ThemeInterface } from './theme';
2017-11-19 22:27:44 +03:00
export type StyledFunction<T> = styledComponents.ThemedStyledFunction<T, ThemeInterface>;
2017-10-12 00:01:37 +03:00
function withProps<T, U extends HTMLElement = HTMLElement>(
styledFunction: StyledFunction<React.HTMLProps<U>>,
): StyledFunction<T & React.HTMLProps<U>> {
return styledFunction;
}
const {
default: styled,
css,
injectGlobal,
keyframes,
ThemeProvider,
withTheme,
} = (styledComponents as ThemedStyledComponentsModule<any>) as ThemedStyledComponentsModule<
ThemeInterface
>;
export { css, injectGlobal, keyframes, ThemeProvider, withTheme, withProps };
export default styled;