Created
June 23, 2021 18:16
-
-
Save hellsan631/d25b64597795b4c4e0c292f83bd08c81 to your computer and use it in GitHub Desktop.
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
interface ComposableComponentProps { | |
icon: React.ReactNode; | |
NameComponent: React.FC<BaseNameComponentProps>; | |
hideIcon?: boolean; | |
IndicatorComponent?: React.FC<BaseIndicatorComponentProps>; | |
children?: React.ReactNode; | |
} | |
export default function ComposableComponent({ | |
icon, | |
NameComponent, | |
hideIcon, | |
IndicatorComponent = BaseIndicatorComponent, | |
children, | |
}: ComposableComponentProps) { | |
return ( | |
<View | |
style={[ | |
styles.row, | |
hideIcon && styles.rowPaddingNoIcon, | |
]}> | |
<IndicatorComponent hideIcon={hideIcon} /> | |
<View style={styles.container}> | |
{!hideIcon && icon} | |
<NameComponent /> | |
{children} | |
</View> | |
</View> | |
); | |
} |
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
interface ComposableComponentProps { | |
icon: React.ReactNode; | |
NameComponent: React.FC<BaseNameComponentProps>; | |
hideIcon?: boolean; | |
IndicatorComponent?: React.FC<BaseIndicatorComponentProps>; | |
children?: React.ReactNode; | |
} | |
export default function ComposableComponent({ | |
icon, | |
NameComponent, | |
hideIcon, | |
IndicatorComponent = BaseIndicatorComponent, | |
children, | |
}: ComposableComponentProps) { | |
return ( | |
<div | |
className={classNames( | |
styles.row, | |
hideIcon && styles.rowPaddingNoIcon, | |
)}> | |
<IndicatorComponent hideIcon={hideIcon} /> | |
<div className={styles.container}> | |
{!hideIcon && icon} | |
<NameComponent /> | |
{children} | |
</div> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment