-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacto(checkbox): mutualisation checkbox (#1473)
- Loading branch information
Showing
7 changed files
with
99 additions
and
73 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
60 changes: 60 additions & 0 deletions
60
front/src/components/baseComponents/blueCheckbox.component.tsx
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,60 @@ | ||
import * as React from "react"; | ||
import { StyleSheet } from "react-native"; | ||
import { CheckBox } from "react-native-elements"; | ||
|
||
import { Colors, FontWeight, Sizes } from "../../styles"; | ||
import { BaseAssets } from "../assets"; | ||
|
||
interface Props { | ||
title: string; | ||
isChecked: boolean; | ||
onPress: () => void; | ||
iconRight?: boolean; | ||
accessibilityLabel?: string; | ||
} | ||
|
||
const BlueCheckbox: React.FC<Props> = ({ | ||
title, | ||
isChecked, | ||
onPress, | ||
iconRight, | ||
accessibilityLabel, | ||
}) => { | ||
return ( | ||
<CheckBox | ||
containerStyle={styles.checkbox} | ||
textStyle={[styles.label, isChecked ? styles.selectedLabel : null]} | ||
iconRight={iconRight} | ||
uncheckedIcon={ | ||
<BaseAssets.CheckboxUncheckedIcon width={Sizes.sm} height={Sizes.sm} /> | ||
} | ||
checkedIcon={ | ||
<BaseAssets.CheckboxCheckedIcon width={Sizes.sm} height={Sizes.sm} /> | ||
} | ||
uncheckedColor={Colors.primaryBlueDark} | ||
checkedColor={Colors.primaryBlueDark} | ||
title={title} | ||
checked={isChecked} | ||
onPress={onPress} | ||
accessibilityLabel={accessibilityLabel ?? title} | ||
accessibilityState={{ checked: isChecked }} | ||
/> | ||
); | ||
}; | ||
const styles = StyleSheet.create({ | ||
checkbox: { | ||
backgroundColor: "transparent", | ||
borderColor: "transparent", | ||
minHeight: Sizes.accessibilityMinButton, | ||
}, | ||
label: { | ||
color: Colors.primaryBlueDark, | ||
flex: 1, | ||
fontWeight: FontWeight.normal, | ||
}, | ||
selectedLabel: { | ||
fontWeight: FontWeight.bold, | ||
}, | ||
}); | ||
|
||
export default BlueCheckbox; |
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
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