mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
wix-style-react: add loader types (#38587)
This commit is contained in:
committed by
Ben Lichtman
parent
230db3f0f1
commit
3f497eb7d9
+8
@@ -0,0 +1,8 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export interface WixComponentProps {
|
||||
dataHook?: string;
|
||||
styles?: string;
|
||||
}
|
||||
|
||||
export default class WixComponent<T extends WixComponentProps = {}> extends React.PureComponent<T> {}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import WixComponent, { WixComponentProps } from './BaseComponents';
|
||||
|
||||
export interface LoaderProps extends WixComponentProps {
|
||||
size?: LoaderSize;
|
||||
color?: LoaderColor;
|
||||
text?: React.ReactNode;
|
||||
status?: LoaderStatus;
|
||||
statusMessage?: string;
|
||||
shouldLoadAsync?: boolean;
|
||||
}
|
||||
|
||||
export default class Loader extends WixComponent<LoaderProps> {}
|
||||
|
||||
export type LoaderSize = 'tiny' | 'small' | 'medium' | 'large';
|
||||
|
||||
export type LoaderColor = 'blue' | 'white';
|
||||
|
||||
export type LoaderStatus = 'loading' | 'success' | 'error';
|
||||
Vendored
+2
@@ -6,3 +6,5 @@
|
||||
|
||||
export { default as Button, ButtonProps } from './Button';
|
||||
export { default as Text, TextProps } from './Text';
|
||||
export { default as WixComponent, WixComponentProps } from './BaseComponents';
|
||||
export { default as Loader, LoaderProps } from './Loader';
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import WixComponent from 'wix-style-react/BaseComponents';
|
||||
|
||||
function WixComponentWithMandatoryProps() {
|
||||
return <WixComponent />;
|
||||
}
|
||||
|
||||
function WixComponentWithAllProps() {
|
||||
return <WixComponent dataHook="hook" styles="14px" />;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import Loader from 'wix-style-react/Loader';
|
||||
|
||||
function LoaderWithMandatoryProps() {
|
||||
return <Loader />;
|
||||
}
|
||||
|
||||
function LoaderWithAllProps() {
|
||||
return (
|
||||
<Loader
|
||||
color="blue"
|
||||
dataHook="hook"
|
||||
size="large"
|
||||
status="error"
|
||||
statusMessage="msg"
|
||||
text="text"
|
||||
shouldLoadAsync
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -19,6 +19,10 @@
|
||||
"Text.d.ts",
|
||||
"test/Text-tests.tsx",
|
||||
"Button.d.ts",
|
||||
"test/Button-tests.tsx"
|
||||
"test/Button-tests.tsx",
|
||||
"Loader.d.ts",
|
||||
"test/Loader-tests.tsx",
|
||||
"BaseComponents.d.ts",
|
||||
"test/BaseComponents-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
// verify that all imports work
|
||||
|
||||
import { Button, Text } from 'wix-style-react';
|
||||
import { Button, Text, Loader } from 'wix-style-react';
|
||||
|
||||
Reference in New Issue
Block a user