Home Reference Source

src/views/diary/components/NavToStart.js

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

import ToStartRoundButton from '../../../components/buttons/ToStartRoundButton';

import {RoundButtonSize} from '../../../utils/DimensionsConstants';

/**
 * Component displaying the menu to navigate to the cover page.
 * Button is displayed if props.isVisible is true.
 * @param {Object} props - Properties
 * @param {Object} props.containerStyle - Style of container
 * @param {boolean} props.isVisible - If true, the button is visible. Otherwise not visible
 * @param {function} props.onPress - Action to be executed when the button is pressed
 * @returns {Object} Navigation menu to go back to the cover page
 */
export default function NavToStart(props) {
    // Retrieve props
    const containerStyle = props.containerStyle;
    const isVisible = props.isVisible;
    const onPressAction = props.onPress;

    return (
        <View style={containerStyle}>
            {isVisible && (
                <ToStartRoundButton
                    buttonSize={RoundButtonSize.SMALL}
                    onPress={onPressAction}
                />
            )}
        </View>
    );
}