-
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.
Show a delete icon in the right side of the Chip component when the onDeletePress prop is set.
- Loading branch information
1 parent
44b78bf
commit 697af2a
Showing
12 changed files
with
124 additions
and
26 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
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,12 +1,17 @@ | ||
import type { ReactElement } from 'react'; | ||
import type { ComponentStyledProps } from 'src/core/components/types'; | ||
import type { ComponentStyledProps, IHoverableComponent } from '../../../core/components/types'; | ||
import type { IIconProps } from '../Icon/types'; | ||
import type { IPressableProps } from '../Pressable/types'; | ||
|
||
export interface IChipProps extends Omit<IPressableProps, 'children' | 'variant' | 'size'>, | ||
ComponentStyledProps<'Chip'> | ||
ComponentStyledProps<'Chip'>, | ||
IHoverableComponent | ||
{ | ||
label: string, | ||
|
||
selected?: boolean, | ||
|
||
icon?: ReactElement<IIconProps>, | ||
deleteIcon?: ReactElement<IIconProps>, | ||
onDeletePress?: IPressableProps[ 'onPress' ] | ||
} |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
import React, { ReactElement } from 'react'; | ||
|
||
export type ComponentPropTypes<PropsType> = Partial<PropsType> & React.Attributes; | ||
export type ComponentType<PropsType extends Partial<PropsType> & React.Attributes> = ( | ||
props: PropsType | ||
) => JSX.Element; | ||
|
||
export const cloneElement = <PropsType extends ComponentPropTypes<PropsType>>( | ||
element: ReactElement<PropsType> | undefined, | ||
props: PropsType | ||
) => ( | ||
element && React.isValidElement( element ) | ||
? React.cloneElement( element, { ...props, ...element.props } ) | ||
: null | ||
); | ||
|
||
export const createComponent = < | ||
PropsType extends ComponentPropTypes<PropsType>, | ||
FromPropsType extends PropsType | ||
>( | ||
componentType: ComponentType<PropsType>, | ||
{ from, props = {} as FromPropsType }: { | ||
from?: ReactElement<FromPropsType>, | ||
props?: Partial<PropsType> | ||
} | ||
) => ( | ||
React.createElement( | ||
componentType, | ||
{ ...props, ...( from?.props || {} ) } as PropsType | ||
) | ||
); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import Svg, { Path } from 'react-native-svg'; | ||
import type { SVGIconProps } from './types'; | ||
|
||
const CloseOutlined = ( { color, ...props }: SVGIconProps ) => ( | ||
<Svg color={color} viewBox="0 0 20 20" fill="none" {...props}> | ||
<Path d="M 11.409 9.998 L 15.705 5.713 C 15.894 5.524 15.998 5.269 15.998 5.003 C 15.998 4.735 15.894 4.482 15.705 4.295 C 15.517 4.105 15.261 4 14.995 4 C 14.73 4 14.474 4.105 14.287 4.295 L 10.001 8.589 L 5.714 4.295 C 5.526 4.105 5.27 4 5.005 4 C 4.739 4 4.483 4.105 4.295 4.295 C 4.106 4.482 4.002 4.735 4.002 5.003 C 4.002 5.269 4.106 5.524 4.295 5.713 L 8.593 9.998 L 4.295 14.286 C 4.201 14.378 4.128 14.49 4.076 14.61 C 4.027 14.732 4 14.863 4 14.995 C 4 15.127 4.027 15.258 4.076 15.379 C 4.128 15.501 4.201 15.612 4.295 15.703 C 4.388 15.798 4.499 15.871 4.621 15.924 C 4.742 15.973 4.873 16 5.005 16 C 5.137 16 5.268 15.973 5.389 15.924 C 5.51 15.871 5.621 15.798 5.714 15.703 L 10.001 11.407 L 14.287 15.703 C 14.379 15.798 14.49 15.871 14.611 15.924 C 14.732 15.973 14.863 16 14.995 16 C 15.127 16 15.258 15.973 15.379 15.924 C 15.501 15.871 15.612 15.798 15.705 15.703 C 15.799 15.612 15.872 15.501 15.924 15.379 C 15.974 15.258 16 15.127 16 14.995 C 16 14.863 15.974 14.732 15.924 14.61 C 15.872 14.49 15.799 14.378 15.705 14.286 L 11.409 9.998 Z" fill={color} /> | ||
</Svg> | ||
); | ||
|
||
export default CloseOutlined; |
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