Home Reference Source

src/components/buttons/BackSquareButton.js

import React from 'react';
import {StyleSheet} from 'react-native';

import BaseSquareButtonLeftIcon from './BaseSquareButtonLeftIcon';
import LeftArrowSvgr from '../../assets/iconsSvgr/LeftArrowSvgr';

import {ColorPalette} from '../../utils/ColorConstants';

/**
 * Component displaying a square "back" button.
 * @param {Object} props - Properties
 * @param {function} props.onPress - Action to be executed when the button is pressed
 * @returns {Object} - Square "back" button
 */
export default function BackSquareButton(props) {
    // Retrieve props
    const onPressAction = props.onPress;

    const icon = <LeftArrowSvgr />;
    const label = ['TILBAKE'];

    return (
        <BaseSquareButtonLeftIcon
            onPress={onPressAction}
            componentStyle={styles.container}
            icon={icon}
            label={label}
            labelStyle={styles.label}
        />
    );
}

/**
 * Local styles
 */
const styles = StyleSheet.create({
    container: {
        backgroundColor: ColorPalette.SOFT_ORANGE,
    },
    label: {
        color: ColorPalette.BLACK,
    },
});