переработал систему модалок и добавил блоки

This commit is contained in:
GP_DEV
2025-06-07 23:28:58 +03:00
parent decc7c470a
commit f23ac49f97
6 changed files with 224 additions and 171 deletions

View File

@@ -73,6 +73,29 @@ function register_acf_blocks() {
),
));
acf_register_block_type(array(
'name' => 'form-block',
'title' => __('Блок формы'),
'description' => __('Блок формы обратной связи'),
'render_template' => 'template-parts/la-components/blocks/form-block/form-block.php',
'category' => 'theme-blocks',
'icon' => 'id-alt',
'keywords' => array('форма', 'форма записи', 'имя', 'телефон'),
'supports' => array(
'align' => array('wide', 'full'),
'anchor' => true,
'customClassName' => true,
),
'enqueue_assets' => function() {
wp_enqueue_style(
'form-block-css',
get_template_directory_uri() . '/template-parts/la-components/blocks/form-block/form-block.css',
[],
'1.0.0'
);
}
));
acf_register_block_type(array(
'name' => 'tiles-block',
'title' => __('Блок с плитками'),
@@ -88,6 +111,22 @@ function register_acf_blocks() {
),
));
acf_register_block_type(array(
'name' => 'advantages-block',
'title' => __('Блок преимуществ'),
'description' => __('Блок с преимуществами'),
'render_template' => 'template-parts/la-components/blocks/advantages-block/advantages-block.php',
'category' => 'theme-blocks',
'icon' => 'grid-view',
'keywords' => array('преимущества', 'карточки', 'advantages', 'преимущество'),
'supports' => array(
'align' => array('wide', 'full'),
'anchor' => true,
'customClassName' => true,
),
));
acf_register_block_type(array(
'name' => 'reviews-block',
'title' => __('Блок с отзывами'),

View File

@@ -5,15 +5,13 @@ function enqueue_theme_scripts() {
'modals-js',
get_template_directory_uri() . '/template-parts/la-components/js/modals.js',
array('jquery'),
'1.0.0',
'2.0.0',
true
);
}
add_action('wp_enqueue_scripts', 'enqueue_theme_scripts');
// Вывод всех модалок в футере
function modal_system_container() {
// Получаем список всех модалок
$modals_dir = get_template_directory() . '/template-parts/la-components/modals/';
$modals = array();
@@ -26,25 +24,18 @@ function modal_system_container() {
}
}
// общий контейнер
?>
<div id="modal-overlay" class="fixed inset-0 bg-[rgba(0,0,0,0.5)] backdrop-blur-sm z-50 flex items-center justify-center p-4 opacity-0 invisible transition-all duration-300">
<div class="bg-white rounded-lg shadow-2xl max-w-2xl w-full max-h-[90vh] relative transform scale-90 transition-transform duration-300 overflow-hidden">
<button id="modal-close" class="absolute top-4 right-4 z-10 w-8 h-8 flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors text-gray-500 hover:text-gray-700">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
<!-- Контейнер для контента модалок -->
<div id="modal-content" class="overflow-y-auto max-h-[90vh]">
</div>
<div id="modal-content" class="overflow-y-auto max-h-[90vh]"></div>
</div>
</div>
<div id="modal-templates" class="hidden">
<?php foreach ($modals as $modal_name): ?>
<div id="modal-template-<?php echo esc_attr($modal_name); ?>" class="modal-template">