<?php
/**
 * Notice template.
 *
 * @var string $notice_key
 * @var string $classes
 * @var array $notice
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

?>
	<div id="storeengine-admin-notice-<?php echo esc_attr( $notice['key'] ); ?>" class="<?php echo esc_attr( $classes ); ?>" role="alert">
		<?php if ( $notice['title'] ) { ?>
			<h3 class="storeengine-admin-notice__title">
				<span class="storeengine-icon storeengine-icon--<?php echo esc_attr( $notice['icon'] ); ?>" style="display:flex" aria-hidden="true"></span>
				<span><?php echo esc_html( $notice['title'] ); ?></span>
			</h3>
		<?php } ?>
		<div class="storeengine-admin-notice__wrapper">
			<?php if ( ! $notice['title'] && $notice['icon'] ) { ?>
				<div class="storeengine-admin-notice__icon">
					<span class="storeengine-icon storeengine-icon--<?php echo esc_attr( $notice['icon'] ); ?>" aria-hidden="true"></span>
				</div>
			<?php } ?>
			<div class="storeengine-admin-notice__content"><?php echo wp_kses_post( $notice['message'] ); ?></div>
			<?php if ( $notice['has_buttons'] ) { ?>
				<div class="storeengine-admin-notice__control">
					<?php if ( $notice['button_text'] && $notice['button_action'] ) { ?>
						<a class="<?php echo esc_attr( $notice['button_class'] ?: 'storeengine-btn storeengine-btn--md storeengine-btn--preset-blue' ); ?>" href="<?php echo esc_url( $notice['button_action'] ); ?>"<?php echo ! empty( $notice['button_target'] ) ? ' target="' . esc_attr( $notice['button_target'] ) . '"' : '' ?>>
							<?php echo esc_html( $notice['button_text'] ); ?>
						</a>
					<?php } ?>
					<?php if ( $notice['dismissible'] ) { ?>
						<button class="storeengine-admin-notice-close notice-dismiss" data-notice="<?php echo esc_attr( $notice['key'] ); ?>">
							<span class="storeengine-icon storeengine-icon--close" aria-hidden="true"></span>
							<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'storeengine' ); ?></span>
						</button>
					<?php } ?>
				</div>
			<?php } ?>
		</div>
	</div>
<?php
