mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { TouchableOpacity } from "react-native";
|
|
import { Text } from "@/components/common/Text";
|
|
import DisabledSetting from "@/components/settings/DisabledSetting";
|
|
|
|
interface StepperProps {
|
|
value: number;
|
|
disabled?: boolean;
|
|
step: number;
|
|
min: number;
|
|
max: number;
|
|
onUpdate: (value: number) => void;
|
|
appendValue?: string;
|
|
}
|
|
|
|
export const Stepper: React.FC<StepperProps> = ({
|
|
value,
|
|
disabled,
|
|
step,
|
|
min,
|
|
max,
|
|
onUpdate,
|
|
appendValue,
|
|
}) => {
|
|
return (
|
|
<DisabledSetting
|
|
disabled={disabled === true}
|
|
showText={false}
|
|
className='flex flex-row items-center'
|
|
>
|
|
<TouchableOpacity
|
|
onPress={() => onUpdate(Math.max(min, value - step))}
|
|
className='w-8 h-8 bg-neutral-800 rounded-l-lg flex items-center justify-center'
|
|
>
|
|
<Text>-</Text>
|
|
</TouchableOpacity>
|
|
<Text
|
|
className={`w-auto h-8 bg-neutral-800 py-2 px-1 flex items-center justify-center${appendValue ? "first-letter:px-2" : ""}`}
|
|
>
|
|
{value}
|
|
{appendValue}
|
|
</Text>
|
|
<TouchableOpacity
|
|
className='w-8 h-8 bg-neutral-800 rounded-r-lg flex items-center justify-center'
|
|
onPress={() => onUpdate(Math.min(max, value + step))}
|
|
>
|
|
<Text>+</Text>
|
|
</TouchableOpacity>
|
|
</DisabledSetting>
|
|
);
|
|
};
|