diff --git a/src/components/menu-grid-list.component.tsx b/src/components/menu-grid-list.component.tsx index ad9dbd24..274a1a41 100644 --- a/src/components/menu-grid-list.component.tsx +++ b/src/components/menu-grid-list.component.tsx @@ -16,12 +16,14 @@ export const MenuGridList = (props: MenuGridListProps): ListElement => { props.onItemPress(info.index)}> - {info.item.icon({ width: 64, height: 64, alignSelf: 'center' })} - - {info.item.title} - + <> + {info.item.icon({ width: 64, height: 64, alignSelf: 'center' })} + + {info.item.title} + + ); @@ -55,5 +57,6 @@ const styles = StyleSheet.create({ itemTitle: { alignSelf: 'center', marginTop: 8, + textAlign: 'center', }, }); diff --git a/src/navigation/components.navigator.tsx b/src/navigation/components.navigator.tsx index 61ac792f..95ce7cb0 100644 --- a/src/navigation/components.navigator.tsx +++ b/src/navigation/components.navigator.tsx @@ -30,6 +30,8 @@ import { TextScreen } from '../scenes/components/text/text.component'; import { ToggleScreen } from '../scenes/components/toggle/toggle.component'; import { TooltipScreen } from '../scenes/components/tooltip/tooltip.component'; import { TopNavigationScreen } from '../scenes/components/top-navigation/top-navigation.component'; +import { ProgressBarScreen } from '../scenes/components/progress-bar/progressBar.component'; +import { CircularProgressBarScreen } from '../scenes/components/circular-progress-bar/circularProgressBar.component'; const Stack = createStackNavigator(); @@ -44,6 +46,7 @@ export const ComponentsNavigator = (): React.ReactElement => ( + @@ -54,6 +57,7 @@ export const ComponentsNavigator = (): React.ReactElement => ( + diff --git a/src/scenes/components/circular-progress-bar/circularProgressBar-showcase.component.tsx b/src/scenes/components/circular-progress-bar/circularProgressBar-showcase.component.tsx new file mode 100644 index 00000000..e8265eac --- /dev/null +++ b/src/scenes/components/circular-progress-bar/circularProgressBar-showcase.component.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { CircularProgressBar, ProgressBarElement, ProgressBarProps } from '@ui-kitten/components'; +import { useProgress } from '../progress-bar/progress.hook'; + +export const CircularProgressBarShowcase = (props?: ProgressBarProps): ProgressBarElement => { + return ( + + ); +}; diff --git a/src/scenes/components/circular-progress-bar/circularProgressBar.component.tsx b/src/scenes/components/circular-progress-bar/circularProgressBar.component.tsx new file mode 100644 index 00000000..5e0defa2 --- /dev/null +++ b/src/scenes/components/circular-progress-bar/circularProgressBar.component.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { ShowcaseContainer } from '../../../components/showcase-container.component'; +import { circularProgressBarSettings, circularProgressBarShowcase } from './type'; +import { CircularProgressBarShowcase } from './circularProgressBar-showcase.component'; + +export const CircularProgressBarScreen = ({ navigation }): React.ReactElement => ( + + +); + diff --git a/src/scenes/components/circular-progress-bar/type.tsx b/src/scenes/components/circular-progress-bar/type.tsx new file mode 100644 index 00000000..8ec81640 --- /dev/null +++ b/src/scenes/components/circular-progress-bar/type.tsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { StarIcon } from '../../../components/icons'; + +import { + ComponentShowcase, + ComponentShowcaseItem, + ComponentShowcaseSection, + ComponentShowcaseSetting, +} from '../../../model/showcase.model'; + +const giant: ComponentShowcaseItem = { + title: 'Giant', + props: { + accessoryLeft: StarIcon, + size: 'giant', + }, +}; + +const large: ComponentShowcaseItem = { + title: 'Large', + props: { + accessoryLeft: StarIcon, + size: 'large', + }, +}; + +const medium: ComponentShowcaseItem = { + title: 'Medium', + props: { + size: 'medium', + }, +}; + +const small: ComponentShowcaseItem = { + title: 'Small', + props: { + size: 'small', + }, +}; + +const tiny: ComponentShowcaseItem = { + title: 'Tiny', + props: { + size: 'tiny', + }, +}; + +const sizeSection: ComponentShowcaseSection = { + title: 'Size', + items: [ + giant, + large, + medium, + small, + tiny, + ], +}; + +export const circularProgressBarSettings: ComponentShowcaseSetting[] = [ + { + propertyName: 'status', + value: 'primary', + }, + { + propertyName: 'status', + value: 'success', + }, + { + propertyName: 'status', + value: 'info', + }, + { + propertyName: 'status', + value: 'warning', + }, + { + propertyName: 'status', + value: 'danger', + }, + { + propertyName: 'status', + value: 'control', + }, + { + propertyName: 'status', + value: 'basic', + }, +]; + +export const circularProgressBarShowcase: ComponentShowcase = { + title: 'ProgressBar', + sections: [ + sizeSection, + ], +}; + diff --git a/src/scenes/components/data.ts b/src/scenes/components/data.ts index 6b1300c1..485b2dd6 100644 --- a/src/scenes/components/data.ts +++ b/src/scenes/components/data.ts @@ -140,6 +140,16 @@ export const data: ComponentData[] = [ ); }, }, + { + title: 'Circular Progress Bar', + route: 'CircularProgressBar', + icon: (style: ImageStyle) => { + return React.createElement( + ThemedIcon, + { ...style, light: AssetCheckBoxIcon, dark: AssetCheckBoxDarkIcon }, + ); + }, + }, { title: 'Datepicker', route: 'Datepicker', @@ -240,6 +250,16 @@ export const data: ComponentData[] = [ ); }, }, + { + title: 'Progress Bar', + route: 'ProgressBar', + icon: (style: ImageStyle) => { + return React.createElement( + ThemedIcon, + { ...style, light: AssetPopoverIcon, dark: AssetPopoverDarkIcon }, + ); + }, + }, { title: 'Radio', route: 'Radio', diff --git a/src/scenes/components/progress-bar/progress.hook.ts b/src/scenes/components/progress-bar/progress.hook.ts new file mode 100644 index 00000000..acb3af72 --- /dev/null +++ b/src/scenes/components/progress-bar/progress.hook.ts @@ -0,0 +1,14 @@ +import { useEffect, useState } from 'react'; + +export const useProgress = (clearValue: any, initialProgress: number = 0, + intervalMs: number = 250, step: number = 0.1) => { + const [progress, setProgress] = useState(initialProgress); + useEffect(() => { + const interval = setInterval(() => setProgress(progress + step > 1 ? 1 : progress + step), intervalMs); + return () => clearInterval(interval); + }, [progress, setProgress]); + useEffect(() => { + setProgress(initialProgress); + }, [clearValue]); + return progress; +}; diff --git a/src/scenes/components/progress-bar/progressBar-showcase.component.tsx b/src/scenes/components/progress-bar/progressBar-showcase.component.tsx new file mode 100644 index 00000000..7adeedb0 --- /dev/null +++ b/src/scenes/components/progress-bar/progressBar-showcase.component.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { ProgressBar, ProgressBarElement, ProgressBarProps } from '@ui-kitten/components'; +import { useProgress } from './progress.hook'; + +export const ProgressBarShowcase = (props?: ProgressBarProps): ProgressBarElement => { + return ( + + ); +}; diff --git a/src/scenes/components/progress-bar/progressBar.component.tsx b/src/scenes/components/progress-bar/progressBar.component.tsx new file mode 100644 index 00000000..363a005d --- /dev/null +++ b/src/scenes/components/progress-bar/progressBar.component.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { progressBarSettings, progressBarShowcase } from './type'; +import { ShowcaseContainer } from '../../../components/showcase-container.component'; +import { ProgressBarShowcase } from './progressBar-showcase.component'; + +export const ProgressBarScreen = ({ navigation }): React.ReactElement => ( + + +); + diff --git a/src/scenes/components/progress-bar/type.tsx b/src/scenes/components/progress-bar/type.tsx new file mode 100644 index 00000000..bc3c2a4a --- /dev/null +++ b/src/scenes/components/progress-bar/type.tsx @@ -0,0 +1,95 @@ +import React from 'react'; +import { StarIcon } from '../../../components/icons'; +import { + ComponentShowcase, + ComponentShowcaseItem, + ComponentShowcaseSection, + ComponentShowcaseSetting, +} from '../../../model/showcase.model'; + +const giant: ComponentShowcaseItem = { + title: 'Giant', + props: { + accessoryLeft: StarIcon, + size: 'giant', + }, +}; + +const large: ComponentShowcaseItem = { + title: 'Large', + props: { + accessoryLeft: StarIcon, + size: 'large', + }, +}; + +const medium: ComponentShowcaseItem = { + title: 'Medium', + props: { + size: 'medium', + }, +}; + +const small: ComponentShowcaseItem = { + title: 'Small', + props: { + size: 'small', + }, +}; + +const tiny: ComponentShowcaseItem = { + title: 'Tiny', + props: { + size: 'tiny', + }, +}; + +const sizeSection: ComponentShowcaseSection = { + title: 'Size', + items: [ + giant, + large, + medium, + small, + tiny, + ], +}; + +export const progressBarSettings: ComponentShowcaseSetting[] = [ + { + propertyName: 'status', + value: 'primary', + }, + { + propertyName: 'status', + value: 'success', + }, + { + propertyName: 'status', + value: 'info', + }, + { + propertyName: 'status', + value: 'warning', + }, + { + propertyName: 'status', + value: 'danger', + }, + { + propertyName: 'status', + value: 'control', + }, + { + propertyName: 'status', + value: 'basic', + }, +]; + +export const progressBarShowcase: ComponentShowcase = { + title: 'ProgressBar', + sections: [ + sizeSection, + ], +}; +