Skip to content

Commit

Permalink
fix: use label for consistency, made label optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Feb 4, 2025
1 parent af8f5bc commit ae5894a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/ComponentTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ComponentTest = () => {
</View>

<StringArrayEditor title="Test Input Label" value={data} setValue={setData} />
<ThemedCheckbox name="Test Checkbox" value={checkbox} onChangeValue={setCheckbox} />
<ThemedCheckbox label="Test Checkbox" value={checkbox} onChangeValue={setCheckbox} />
<ThemedSwitch label="Test Switch" value={sw} onChangeValue={setSw} />
<ThemedSlider
value={slider}
Expand Down
2 changes: 1 addition & 1 deletion app/SamplerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const SamplerMenu = () => {
},
})
}}
name={samplerItem.friendlyName}
label={samplerItem.friendlyName}
/>
)
case 'textinput':
Expand Down
20 changes: 11 additions & 9 deletions app/components/input/ThemedCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import Animated, {
} from 'react-native-reanimated'

type ThemedCheckboxProps = {
name: string
label?: string
value: boolean
onChangeValue?: (item: boolean) => void
style?: ViewStyle
}

const ThemedCheckbox: React.FC<ThemedCheckboxProps> = ({
name,
label = undefined,
value,
onChangeValue = () => {},
style = {},
Expand Down Expand Up @@ -73,13 +73,15 @@ const ThemedCheckbox: React.FC<ThemedCheckboxProps> = ({
</Animated.View>
)}
</Animated.View>
<Text
style={{
paddingLeft: 12,
color: value ? theme.color.text._100 : theme.color.text._400,
}}>
{name}
</Text>
{label && (
<Text
style={{
paddingLeft: 12,
color: value ? theme.color.text._100 : theme.color.text._400,
}}>
{label}
</Text>
)}
</Pressable>
)
}
Expand Down
14 changes: 7 additions & 7 deletions app/screens/FormattingManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ const FormattingManager = () => {
}}>
<View>
<ThemedCheckbox
name="Wrap In Newline"
label="Wrap In Newline"
value={currentInstruct.wrap}
onChangeValue={(b) => {
setCurrentInstruct({
Expand All @@ -348,7 +348,7 @@ const FormattingManager = () => {
}}
/>
<ThemedCheckbox
name="Include Names"
label="Include Names"
value={currentInstruct.names}
onChangeValue={(b) => {
setCurrentInstruct({
Expand All @@ -358,7 +358,7 @@ const FormattingManager = () => {
}}
/>
<ThemedCheckbox
name="Add Timestamp"
label="Add Timestamp"
value={currentInstruct.timestamp}
onChangeValue={(b) => {
setCurrentInstruct({
Expand All @@ -370,7 +370,7 @@ const FormattingManager = () => {
</View>
<View>
<ThemedCheckbox
name="Use Examples"
label="Use Examples"
value={currentInstruct.examples}
onChangeValue={(b) => {
setCurrentInstruct({
Expand All @@ -380,7 +380,7 @@ const FormattingManager = () => {
}}
/>
<ThemedCheckbox
name="Use Scenario"
label="Use Scenario"
value={currentInstruct.scenario}
onChangeValue={(b) => {
setCurrentInstruct({
Expand All @@ -391,7 +391,7 @@ const FormattingManager = () => {
/>

<ThemedCheckbox
name="Use Personality"
label="Use Personality"
value={currentInstruct.personality}
onChangeValue={(b) => {
setCurrentInstruct({
Expand Down Expand Up @@ -430,7 +430,7 @@ const FormattingManager = () => {
{autoformatterData.map((item, index) => (
<ThemedCheckbox
key={item.label}
name={item.label}
label={item.label}
value={currentInstruct.format_type === index}
onChangeValue={(b) => {
if (b)
Expand Down

0 comments on commit ae5894a

Please sign in to comment.