Skip to content

Commit

Permalink
feat(playground): missing spinner showcases add
Browse files Browse the repository at this point in the history
  • Loading branch information
32penkin committed Aug 19, 2019
1 parent 3164de8 commit 881c668
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/playground/src/ui/screen/spinner/spinner.container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { SpinnerProps } from '@kitten/ui';
import {
SpinnerProps,
SpinnerElement,
} from '@kitten/ui';
import { SpinnerShowcase } from './spinnerShowcase.component';
import {
spinnerSettings,
Expand All @@ -9,7 +12,7 @@ import { ShowcaseContainer } from '../common/showcase.container';

export class SpinnerContainer extends React.Component {

private renderItem = (props: SpinnerProps): React.ReactElement<SpinnerProps> => {
private renderItem = (props: SpinnerProps): SpinnerElement => {
return (
<SpinnerShowcase {...props}/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
import React from 'react';
import {
StyleSheet,
View,
ViewProps,
} from 'react-native';
import {
Spinner,
SpinnerProps,
SpinnerElement,
} from '@kitten/ui';

export const SpinnerShowcase = (props?: SpinnerProps): React.ReactElement<SpinnerProps> => {
export const SpinnerShowcase = (props?: SpinnerProps): SpinnerElement => {
if (props.status === 'white') {
return WhiteSpinner(props);
} else {
return DefaultSpinner(props);
}
};

const DefaultSpinner = (props?: SpinnerProps): SpinnerElement => {
return (
<Spinner {...props} />
);
};

const WhiteSpinner = (props?: SpinnerProps): React.ReactElement<ViewProps> => {
return (
<View style={styles.blackSpinnerContainer}>
<Spinner {...props} />
</View>
);
};

const styles = StyleSheet.create({
blackSpinnerContainer: {
width: 40,
height: 40,
backgroundColor: '#7f7e82',
justifyContent: 'center',
alignItems: 'center',
},
});
16 changes: 16 additions & 0 deletions src/playground/src/ui/screen/spinner/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ const dangerSpinner: ComponentShowcaseItem = {
},
};

const blackSpinner: ComponentShowcaseItem = {
title: 'Black',
props: {
status: 'black',
},
};

const whiteSpinner: ComponentShowcaseItem = {
title: 'White',
props: {
status: 'white',
},
};

const sizeSection: ComponentShowcaseSection = {
title: 'Size',
items: [
Expand All @@ -94,6 +108,8 @@ const statusSection: ComponentShowcaseSection = {
infoSpinner,
warningSpinner,
dangerSpinner,
blackSpinner,
whiteSpinner,
],
};

Expand Down

0 comments on commit 881c668

Please sign in to comment.