<?php
/**
 * Template Name: Resources
 *
 * @package GoAskAuntie
 * @since 1.0.0
 */

namespace BasicWP;

get_header();

$resources_img = get_theme_file_uri( '/static/img/resources.png' );
?>

<section class="w-full pb-24 bg-teal-light relative">
	<div class="prose prose-sm md:prose-lg lg:prose-xl max-w-5xl md:mx-6 lg:mx-auto pt-12 lg:pt-32 text-gray relative">
		<h1 class="text-4xl font-bold md:text-6xl lg:text-7xl tracking-wide uppercase text-purple mb-16 mx-auto text-left">Resources</h1>

		<div class="grid md:grid-cols-2 grid-cols-1 grid-rows-1">
			<ul class="list-none !pl-0 ml-0">
				<?php
				$resource_args = array(
					'post_type'      => 'resources',
					'posts_per_page' => -1,
					'orderby'        => 'title',
					'order'          => 'ASC',
				);
				$resources_query = new \WP_Query( $resource_args );

				if ( $resources_query->have_posts() ) {
					while ( $resources_query->have_posts() ) {
						$resources_query->the_post();
						$resource_url = get_field( 'resource_url' ) ?: get_permalink();
						echo '<li class="pl-0 ml-0">';
						echo '<a href="' . esc_url( $resource_url ) . '" target="_blank">' . esc_html( get_the_title() ) . '</a>';
						echo '</li>';
					}
					wp_reset_postdata();
				}
				?>
			</ul>
			<div class="hidden md:block">
				<img src="<?php echo esc_url( $resources_img ); ?>" alt="Resources" class="object-contain">
			</div>
		</div>
	</div>
</section>

<!-- Get Social Section -->
<section class="bg-white py-8">
	<div class="h-auto mx-6 lg:mx-auto max-w-5xl bg-white">
		<div class="flex flex-row justify-between items-end">
			<h2 class="uppercase text-purple text-3xl">Get social with <span class="text-red">Go Ask Auntie</span></h2>
			<?php get_template_part( 'views/partials/social-media' ); ?>
		</div>
	</div>
</section>

<?php get_footer(); ?>