import React from 'react';
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
import { colors, radius, spacing, typography } from '../../../theme';

type NearestToggleButtonProps = {
  showNearest: boolean;
  onPress: () => void;
};

const NearestToggleButton = ({ showNearest, onPress }: NearestToggleButtonProps) => {
  return (
    <TouchableOpacity style={styles.button} onPress={onPress}>
      <Text style={styles.text}>
        {showNearest ? 'Tous' : 'Les plus proches'}
      </Text>
    </TouchableOpacity>
  );
};

export default NearestToggleButton;

const styles = StyleSheet.create({
  button: {
    position: 'absolute',
    top: 130,
    right: 20,
    backgroundColor: colors.primary,
    paddingHorizontal: spacing.md,
    paddingVertical: spacing.sm,
    borderRadius: radius.md,
  },
  text: {
    color: colors.white,
    fontWeight: typography.fontWeight.semibold,
  },
});