import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { useFonts } from 'expo-font';
import AppLoading from 'expo-app-loading';
import { SelectableBox } from '@proximus/react-native-common-ui/lib/selectableBox';

export default function App() {
  const [selected, setSelected] = useState(false);
  const [loaded] = useFonts({
    'Proximus-Bold': require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Bold.ttf'),
    'Proximus-Regular': require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Regular.ttf'),
    Proximus: require('@proximus/react-native-font-icons/lib/assets/fonts/Proximus-Regular.ttf'),
  });

  if (!loaded) {
    return <AppLoading />;
  }

  return (
    <View style={styles.container}>
      <View style={styles.viewRow}>
        <SelectableBox
          selected={selected}
          label={selected ? 'Selected' : 'Not selected'}
          onPress={() => setSelected(!selected)}
        />
      </View>
      <View style={styles.viewRow}>
        <SelectableBox
          selected={false}
          label={'Disabled'}
          onPress={() => {}}
          disabled
        />
      </View>
      <View style={styles.viewRow}>
        <SelectableBox
          selected={selected}
          label={'Locked'}
          onPress={() => setSelected(!selected)}
          locked
          helperLabel={'Included in the offer'}
        />
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    justifyContent: 'center',
    padding: 20,
  },
  viewRow: {
    marginBottom: 10,
  },
});
