diff --git a/themes/comite-nacional-lula-livre/assets/images/map-icon.png b/themes/comite-nacional-lula-livre/assets/images/map-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..767a61e7e20d99ef0eac2112da86f9fd75224a15 Binary files /dev/null and b/themes/comite-nacional-lula-livre/assets/images/map-icon.png differ diff --git a/themes/comite-nacional-lula-livre/assets/images/map-icon2.png b/themes/comite-nacional-lula-livre/assets/images/map-icon2.png new file mode 100644 index 0000000000000000000000000000000000000000..d36286959308e299e15544d00005f3bed6f101f7 Binary files /dev/null and b/themes/comite-nacional-lula-livre/assets/images/map-icon2.png differ diff --git a/themes/comite-nacional-lula-livre/assets/javascript/app.js b/themes/comite-nacional-lula-livre/assets/javascript/app.js index 2c3de0383cf7c85c4c9c8de341e8e052ed3ca27b..4c622c438b0513b400e78148fbb5b7e2c24677d6 100644 --- a/themes/comite-nacional-lula-livre/assets/javascript/app.js +++ b/themes/comite-nacional-lula-livre/assets/javascript/app.js @@ -16,6 +16,33 @@ jQuery(window).on('scroll', function(){ } }); +if(jQuery('#mapa-cadastro').length > 0 ){ + var mymap = L.map('mapa-cadastro').setView([-16, -57], 4); + L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { + maxZoom: 18, + attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + + 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', + id: 'mapbox.streets' + }).addTo(mymap); + + var flagIcon = L.icon({ + iconUrl: '/wp-content/themes/comite-nacional-lula-livre/assets/images/map-icon.png', + shadowUrl: '', + iconSize: [30, 30], // size of the icon + shadowSize: [0, 0], // size of the shadow + iconAnchor: [15, 15], // point of the icon which will correspond to marker's location + shadowAnchor: [0, 0], // the same for the shadow + popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor + }); + + if(window.mapa_cadastro){ + window.mapa_cadastro.map(m => { + let marker = L.marker([m.latitude, m.longitude], {icon: flagIcon}).addTo(mymap); + }) + } +} + window.fetchArt = function (id){ jQuery.get('/art/'+id, {}, function(response){ jQuery('.modal-art--content').html(response); diff --git a/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-positioning.scss b/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-positioning.scss index 19d642730897f542e8ca955f66ac598e1bfd50ba..413e56552eeb392cefb15cd0cc4cf23bdb25c4f4 100755 --- a/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-positioning.scss +++ b/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-positioning.scss @@ -71,4 +71,8 @@ .justify-content-end{ justify-content: flex-end; + } + + .relative{ + position: relative; } \ No newline at end of file diff --git a/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-typography.scss b/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-typography.scss index f71290f1eca3ecc0d5ae2b0118e6ddc925f372df..80a1e8d67577d1cd5e0c7263b5824396d3e357c6 100755 --- a/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-typography.scss +++ b/themes/comite-nacional-lula-livre/assets/scss/2--atoms/_a-typography.scss @@ -5,13 +5,13 @@ /*------------------------------------------------------------------------ */ // TYPOGRAPHY - @each $font-size in (8,11,13,15,17,20,26,32,42,50) { + @each $font-size in (8,11,13,14,15,16,17,18,19,20,26,32,42,50) { .fz#{$font-size} { font-size: #{$font-size}px; } } - @each $line-height, $val in ("1-2":1.2,"1-6":1.6,"2":2) { + @each $line-height, $val in ("1-2":1.2,"1-4":1.4,"1-6":1.6,"2":2) { .lh#{$line-height} { line-height: #{$val}em; } diff --git a/themes/comite-nacional-lula-livre/assets/scss/3--components/_c-mapa-cadastro.scss b/themes/comite-nacional-lula-livre/assets/scss/3--components/_c-mapa-cadastro.scss new file mode 100644 index 0000000000000000000000000000000000000000..5ea62bcfd4a69156b2a809b0789d00adc0e5d7f3 --- /dev/null +++ b/themes/comite-nacional-lula-livre/assets/scss/3--components/_c-mapa-cadastro.scss @@ -0,0 +1,29 @@ +.mapa-cadastro{ + + #mapa-cadastro { height: 480px; z-index: 1; } + + .left{ + position: absolute; + top: 50%; + transform: translateY(-50%); + z-index: 10; + max-width: 40%; + left: 0; + } + + .right{ + position: relative; + + &:before{ + content: ''; + position: absolute; + height: 100%; + width: 300px; + top: 0; + left: 0; + z-index: 9; + background: linear-gradient(270deg, rgba(21, 41, 75, 0) 0%, rgba(21, 41, 75, 0.32) 40%, #15294B 98%); + pointer-events: none; + } + } +} \ No newline at end of file diff --git a/themes/comite-nacional-lula-livre/assets/scss/4--layouts/_l-navigation.scss b/themes/comite-nacional-lula-livre/assets/scss/4--layouts/_l-navigation.scss index 671eebcf17ebbea80027ebe4043b92dfaf7ce03a..7672f34972a8a941074d78b4f9f2bb636f9b7e32 100755 --- a/themes/comite-nacional-lula-livre/assets/scss/4--layouts/_l-navigation.scss +++ b/themes/comite-nacional-lula-livre/assets/scss/4--layouts/_l-navigation.scss @@ -27,7 +27,7 @@ body{ align-items: center; transition: all .6s; left: 0; - z-index: 10; + z-index: 100; @include mobile{ left: -90vw; @@ -179,7 +179,7 @@ body{ width: 100vw; background-color: #FFFFFF; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.15); - z-index: 9; + z-index: 100; transition: all .6s; top: 0; position: fixed; diff --git a/themes/comite-nacional-lula-livre/assets/scss/foundation.scss b/themes/comite-nacional-lula-livre/assets/scss/foundation.scss index 33ccfa2c3f3989f6ac6665ebe7c946473c11eb54..97fbac987f5c112e8cdd7fe4263576d864eddc61 100755 --- a/themes/comite-nacional-lula-livre/assets/scss/foundation.scss +++ b/themes/comite-nacional-lula-livre/assets/scss/foundation.scss @@ -119,6 +119,7 @@ $theme-root: '/wp-content/themes/comite-nacional-lula-livre'; @import "3--components/c-art-card"; @import "3--components/c-abra-comite"; @import "3--components/c-banner-small"; +@import "3--components/c-mapa-cadastro"; // LAYOUT PARTS @import "4--layouts/l-navigation"; diff --git a/themes/comite-nacional-lula-livre/dist/app.css b/themes/comite-nacional-lula-livre/dist/app.css index 8fdddf9f711723b23b3cb684305c599e5fd675a5..c8a6bb3a410b8a5a228fb52cac004d2aa672293c 100755 --- a/themes/comite-nacional-lula-livre/dist/app.css +++ b/themes/comite-nacional-lula-livre/dist/app.css @@ -6828,14 +6828,30 @@ body { font-size: 13px; } +.fz14 { + font-size: 14px; +} + .fz15 { font-size: 15px; } +.fz16 { + font-size: 16px; +} + .fz17 { font-size: 17px; } +.fz18 { + font-size: 18px; +} + +.fz19 { + font-size: 19px; +} + .fz20 { font-size: 20px; } @@ -6860,6 +6876,10 @@ body { line-height: 1.2em; } +.lh1-4 { + line-height: 1.4em; +} + .lh1-6 { line-height: 1.6em; } @@ -7115,6 +7135,10 @@ ul.nav { justify-content: flex-end; } +.relative { + position: relative; +} + /* -------------------------------------------------------------------------- SPACING -------------------------------------------------------------------------- */ @@ -7529,14 +7553,30 @@ ul.nav { font-size: 13px; } +.fz14 { + font-size: 14px; +} + .fz15 { font-size: 15px; } +.fz16 { + font-size: 16px; +} + .fz17 { font-size: 17px; } +.fz18 { + font-size: 18px; +} + +.fz19 { + font-size: 19px; +} + .fz20 { font-size: 20px; } @@ -7561,6 +7601,10 @@ ul.nav { line-height: 1.2em; } +.lh1-4 { + line-height: 1.4em; +} + .lh1-6 { line-height: 1.6em; } @@ -9284,6 +9328,36 @@ body .em-calendar td ul li a { color: white; } +.mapa-cadastro #mapa-cadastro { + height: 480px; + z-index: 1; +} + +.mapa-cadastro .left { + position: absolute; + top: 50%; + transform: translateY(-50%); + z-index: 10; + max-width: 40%; + left: 0; +} + +.mapa-cadastro .right { + position: relative; +} + +.mapa-cadastro .right:before { + content: ''; + position: absolute; + height: 100%; + width: 300px; + top: 0; + left: 0; + z-index: 9; + background: linear-gradient(270deg, rgba(21, 41, 75, 0) 0%, rgba(21, 41, 75, 0.32) 40%, #15294B 98%); + pointer-events: none; +} + /* -------------------------------------------------------------------------- NAVIGATION -------------------------------------------------------------------------- */ @@ -9315,7 +9389,7 @@ body { align-items: center; transition: all .6s; left: 0; - z-index: 10; + z-index: 100; } @media (max-width: 767px) { @@ -9478,7 +9552,7 @@ body { width: 100vw; background-color: #FFFFFF; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.15); - z-index: 9; + z-index: 100; transition: all .6s; top: 0; position: fixed; diff --git a/themes/comite-nacional-lula-livre/dist/app.js b/themes/comite-nacional-lula-livre/dist/app.js index 59e8f6bb53c950a94ff40a9c09b362013edc619b..d7e14d119149500762d5e69b72011d3352bab38c 100755 --- a/themes/comite-nacional-lula-livre/dist/app.js +++ b/themes/comite-nacional-lula-livre/dist/app.js @@ -11430,6 +11430,31 @@ jQuery(window).on('scroll', function () { } }); +if (jQuery('#mapa-cadastro').length > 0) { + var mymap = L.map('mapa-cadastro').setView([-16, -57], 4); + L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { + maxZoom: 18, + attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' + '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', + id: 'mapbox.streets' + }).addTo(mymap); + + var flagIcon = L.icon({ + iconUrl: '/wp-content/themes/comite-nacional-lula-livre/assets/images/map-icon.png', + shadowUrl: '', + iconSize: [30, 30], // size of the icon + shadowSize: [0, 0], // size of the shadow + iconAnchor: [15, 15], // point of the icon which will correspond to marker's location + shadowAnchor: [0, 0], // the same for the shadow + popupAnchor: [0, 0] // point from which the popup should open relative to the iconAnchor + }); + + if (window.mapa_cadastro) { + window.mapa_cadastro.map(function (m) { + var marker = L.marker([m.latitude, m.longitude], { icon: flagIcon }).addTo(mymap); + }); + } +} + window.fetchArt = function (id) { jQuery.get('/art/' + id, {}, function (response) { jQuery('.modal-art--content').html(response); diff --git a/themes/comite-nacional-lula-livre/functions.php b/themes/comite-nacional-lula-livre/functions.php index f708a3ccbce1b80969ea187d60a0558c7724f2dd..09a9228cb7f4528811810ec33bdc23a0b4ebfb5e 100644 --- a/themes/comite-nacional-lula-livre/functions.php +++ b/themes/comite-nacional-lula-livre/functions.php @@ -18,7 +18,8 @@ add_action( 'after_setup_theme', function() { } ); function lula_load_assets() { - wp_enqueue_style( 'flickity-css', get_template_directory_uri() . '/dist/flickity.min.css' ); + wp_enqueue_script('no-js', get_stylesheet_directory_uri() . '/no-js.js', array('jquery'), false, true); + wp_enqueue_style( 'flickity-css', get_template_directory_uri() . '/ dist/flickity.min.css' ); wp_enqueue_style( 'app', get_template_directory_uri() . '/dist/app.css', [], filemtime(__DIR__.'/dist/app.css') ); // wp_enqueue_script( 'manifest', get_template_directory_uri() . '/dist/manifest.js', array('jquery'), '1.0.0', true); // wp_enqueue_script( 'vendor', get_template_directory_uri() . '/dist/vendor.js', array('manifest'), '1.0.0', true); diff --git a/themes/comite-nacional-lula-livre/header.php b/themes/comite-nacional-lula-livre/header.php index fb883992a2fce0a01d21f06f756994edec039a71..8eb28b544d8cce973d3f4b873c6fdd19869b4be0 100644 --- a/themes/comite-nacional-lula-livre/header.php +++ b/themes/comite-nacional-lula-livre/header.php @@ -8,10 +8,17 @@ <?php wp_head()?> <title><?php wp_title()?></title> + + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css" + integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" + crossorigin=""/> + <script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js" + integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" + crossorigin=""></script> + <script src="https://www.google.com/recaptcha/api.js?hl=pt-BR" async defer></script> </head> <body <?php body_class();?> > - <script src="https://www.google.com/recaptcha/api.js?hl=pt-BR" async defer></script> <?php if(is_page() && $slider = get_post_meta(get_the_ID(), '_page_slider_shortcode', true)): ?> <header class="slider-revolution"> diff --git a/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/mapa-cadastro.php b/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/mapa-cadastro.php new file mode 100644 index 0000000000000000000000000000000000000000..b856ad3bfa5764900ff606869cdd91d27c8041f3 --- /dev/null +++ b/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/mapa-cadastro.php @@ -0,0 +1,77 @@ +<?php + +/* + Widget Name: Mapa de Cadastros + Description: Adiciona um mapa que exibe os pins dos cadastros + Author: hacklab/ + Author URI: https://hacklab.com.br/ + */ + +namespace widgets; + +class MapaCadastro extends \SiteOrigin_Widget { + + function __construct() { + $fields = [ + 'title' => [ + 'type' => 'text', + 'label' => 'TÃtulo', + 'default' => 'Mapa de Comitês Lula Livre' + ], + 'description' => [ + 'type' => 'text', + 'label' => 'Descrição' + ], + 'button_text' => [ + 'type' => 'text', + 'label' => 'TÃtulo do Botão', + 'default' => 'Cadastre seu comitê' + ], + 'button_link' => [ + 'type' => 'text', + 'label' => 'Link do Botão', + 'default' => '#mapa-cadastro' + ], + ]; + + parent::__construct('mapa-cadastro', 'Mapa de Cadastros', [ + 'panels_groups' => [WIDGETGROUP_MAIN], + 'description' => 'Adiciona um mapa com pins de cadastro' + ], [], $fields, plugin_dir_path(__FILE__) + ); + } + + function get_template_variables($instance, $args) + { + $markers = []; + + $markers_query = new \WP_Query([ + 'post_type' => 'cadastros', + 'posts_per_page' => '-1', + ]); + + while($markers_query->have_posts()){ + $markers_query->the_post(); + + $markers[] = [ + 'latitude' => get_post_meta(get_the_ID(), 'LATITUDE', true), + 'longitude' => get_post_meta(get_the_ID(), 'LONGITUDE', true), + ]; + } + + wp_localize_script('no-js', 'mapa_cadastro', $markers ); + + return []; + } + + function get_template_name($instance) { + return 'template'; + } + + function get_style_name($instance) { + return 'style'; + } + +} + +Siteorigin_widget_register('mapa-cadastro', __FILE__, 'widgets\MapaCadastro'); diff --git a/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/tpl/template.php b/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/tpl/template.php new file mode 100644 index 0000000000000000000000000000000000000000..c16f74b5e3c510b142f45ef8e66010b6e2ecff58 --- /dev/null +++ b/themes/comite-nacional-lula-livre/library/pagebuilder-widgets/mapa-cadastro/tpl/template.php @@ -0,0 +1,12 @@ +<div class="mapa-cadastro wrapper dark"> + <div class="row justify-content-end relative"> + <div class="left"> + <h2 class="text-white section-title"><?= $instance['title']?></h2> + <p class="text-white fz14 lh1-4"><?= $instance['description']?></p> + <a href="<?= $instance['button_link']?>" class="button outline"><?= $instance['button_text']?></a> + </div> + <div class="column large-8 right"> + <div id="mapa-cadastro"></div> + </div> + </div> +</div> \ No newline at end of file