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

export default function App() {
  const [expanded, setExpanded] = useState(false);
  const [loaded] = useFonts({
    // prettier-ignore
    'Nucleo': require('@proximus/react-native-font-icons/lib/assets/fonts/Nucleo.ttf'),
    '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 (
    <ScrollView style={styles.container}>
      <View style={{ marginBottom: 10 }}>
        <PxPanel
          title={'Panel title'}
          content={'Panel content'}
          onPress={() => {}}
          buttonTitle={'Button'}
        />
      </View>
      <View style={{ marginBottom: 10 }}>
        <PxPanel
          title={'Panel title'}
          content={'Panel content'}
          onPress={() => {}}
          buttonTitle={'Button'}
          isExpandable
          expanded={expanded}
          onExpandPress={() => setExpanded(!expanded)}
          expandTitle={'Expand'}
        />
      </View>
      <View style={{ marginBottom: 10 }}>
        <PxPanel
          title={'Panel title'}
          content={'Panel content'}
          onPress={() => {}}
          buttonTitle={'Button'}
          imageSrc={{
            uri: 'https://i.pinimg.com/originals/88/8b/dd/888bdd8a07e6143310cc996c2ec80cc0.jpg',
          }}
        />
      </View>
    </ScrollView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    paddingHorizontal: 5,
    paddingTop: 50,
    paddingBottom: 200,
  },
});
