-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74f60a9
commit 62bb72e
Showing
12 changed files
with
100 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as React from 'react'; | ||
|
||
import { StyleSheet, View } from 'react-native'; | ||
import { | ||
Checkbox, VStack, Text, HStack | ||
} from '@amalgama/react-native-ui-kit'; | ||
|
||
const styles = StyleSheet.create( { | ||
container: { | ||
width: '100%', | ||
marginBottom: 20 | ||
}, | ||
separator: { | ||
height: 1, | ||
minWidth: '100%', | ||
marginTop: 2, | ||
marginBottom: 6, | ||
backgroundColor: 'black' | ||
}, | ||
vspace: { | ||
height: 10, | ||
minWidth: '100%' | ||
} | ||
} ); | ||
|
||
const TextExamples = () => ( | ||
<VStack style={styles.container}> | ||
<Text variant="h1" bgColor="primary.200">Checkbox Component</Text> | ||
<View style={styles.vspace} /> | ||
<Text variant="sh1" color="primary.800">Enabled</Text> | ||
<View style={styles.separator} /> | ||
|
||
<HStack> | ||
<Checkbox></Checkbox> | ||
<Checkbox isSelected></Checkbox> | ||
<Checkbox isIndeterminated></Checkbox> | ||
</HStack> | ||
|
||
<View style={styles.vspace} /> | ||
<Text variant="sh1" color="primary.800">Disabled</Text> | ||
<View style={styles.separator} /> | ||
|
||
<HStack> | ||
<Checkbox disabled></Checkbox> | ||
<Checkbox disabled isSelected></Checkbox> | ||
<Checkbox disabled isIndeterminated></Checkbox> | ||
</HStack> | ||
|
||
<View style={styles.vspace} /> | ||
<Text variant="sh1" color="primary.800">Sizes and colors</Text> | ||
<View style={styles.separator} /> | ||
|
||
<HStack space={'3'} marginX={'3'}> | ||
<Checkbox __icon={{ size: 'xl' }} __unselected={{ __icon: { color: 'error.700' } }}></Checkbox> | ||
<Checkbox isSelected __icon={{ size: 'lg' }} __selected={{ __icon: { color: 'success.500' } }}></Checkbox> | ||
<Checkbox isIndeterminated __icon={{ size: 'md' }} __indeterminate={{ __icon: { color: 'warning.400' } }}></Checkbox> | ||
</HStack> | ||
|
||
<View style={styles.vspace} /> | ||
|
||
</VStack> | ||
); | ||
|
||
export default TextExamples; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import React from 'react'; | ||
import Icon from '../Icon'; | ||
import Pressable from '../Pressable'; | ||
import { useCheckBoxPropsResolver } from './hooks'; | ||
import type { ICheckBoxProps } from './types'; | ||
import { useCheckboxPropsResolver } from './hooks'; | ||
import type { ICheckboxProps } from './types'; | ||
|
||
const CheckBox = ( { | ||
const Checkbox = ( { | ||
isSelected = false, | ||
isIndeterminated = false, | ||
...props | ||
}: ICheckBoxProps ) => { | ||
const { icon, iconProps, containerProps } = useCheckBoxPropsResolver( { | ||
}: ICheckboxProps ) => { | ||
const { iconProps, containerProps } = useCheckboxPropsResolver( { | ||
isIndeterminated, isSelected, ...props | ||
} ); | ||
|
||
return ( | ||
<Pressable {...containerProps}> | ||
<Icon name={icon} {...containerProps} {...iconProps}></Icon> | ||
<Icon {...iconProps}></Icon> | ||
</Pressable> | ||
); | ||
}; | ||
|
||
export default CheckBox; | ||
export default Checkbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import type { ComponentStyledProps } from '../../../core/components/types'; | ||
import type { IPressableProps } from '../Pressable/types'; | ||
|
||
export interface ICheckBoxProps extends Omit<IPressableProps, 'children' | 'size'>, | ||
ComponentStyledProps<'CheckBox'> | ||
export interface ICheckboxProps extends Omit<IPressableProps, 'children' | 'size'>, | ||
ComponentStyledProps<'Checkbox'> | ||
{ | ||
isSelected?: boolean, | ||
isIndeterminated?:boolean, | ||
isIndeterminated?:boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ export { | |
IconButton, | ||
VStack, | ||
Text, | ||
CheckBox | ||
Checkbox | ||
} from './components'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters