form-01--form-container.php
3 years ago
form-02--form-fields.php
3 years ago
form-03--input.php
5 months ago
form-04--select2.php
5 months ago
form-05--select2-dropdown.php
3 years ago
form-06--timepicker-dropdown.php
3 years ago
form-07--radio.php
5 months ago
form-08--checkbox.php
5 months ago
form-09--calendar.php
3 years ago
form-10--submit.php
5 months ago
form-11--options-container.php
3 years ago
form-12--options-title.php
5 months ago
form-13--gdpr.php
5 months ago
form-14--error-message.php
5 months ago
form-15--success-message.php
2 years ago
form-16--recaptcha.php
5 months ago
general-01--module-container.php
3 years ago
general-02--main-layout.php
1 month ago
general-03--layout-header.php
3 years ago
general-04--layout-content.php
3 years ago
general-05--layout-footer.php
3 years ago
general-06--image-size.php
5 months ago
general-07--image-fitting.php
3 years ago
general-08--image-position.php
5 months ago
general-09--content-wrapper.php
3 years ago
general-10--title.php
5 months ago
general-11--subtitle.php
5 months ago
general-12--content.php
5 months ago
general-13--cta-container.php
3 years ago
general-14--cta-button.php
5 months ago
general-15--cta-alignment.php
3 years ago
general-16--nsa-link.php
5 months ago
general-17--close-button.php
3 years ago
general-18--popup-mask.php
3 years ago
general-19--cta-helper-text.php
5 months ago
module-size-embed.php
5 months ago
module-size-popup.php
5 months ago
module-size-slidein.php
3 years ago
general-17--close-button.php
137 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Close Button. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | $component = 'button.hustle-button-close'; |
| 10 | |
| 11 | // SETTINGS: Colors. |
| 12 | $color_default = $colors['close_button_static_color']; |
| 13 | $color_hover = $colors['close_button_hover_color']; |
| 14 | $color_focus = $colors['close_button_active_color']; |
| 15 | $color_background = $colors['close_button_static_background']; |
| 16 | |
| 17 | // SETTINGS: Icon style. |
| 18 | $close_icon_size = $design['close_icon_size']; |
| 19 | $close_icon_size_mobile = ( '' !== $design['close_icon_size_mobile'] && $is_mobile_enabled ) ? $design['close_icon_size_mobile'] : $design['close_icon_size']; |
| 20 | $icon_style = $design['close_icon_style']; |
| 21 | $icon_style_mobile = ( '' !== $design['close_icon_style_mobile'] && $is_mobile_enabled ) ? $design['close_icon_style_mobile'] : $design['close_icon_style']; |
| 22 | |
| 23 | // SETTINGS: Position. |
| 24 | $position = $design['close_icon_position']; |
| 25 | $position_mobile = ( '' !== $design['close_icon_position_mobile'] && $is_mobile_enabled ) ? $design['close_icon_position_mobile'] : $design['close_icon_position']; |
| 26 | $alignment_x = $design['close_icon_alignment_x']; |
| 27 | $alignment_x_mobile = ( '' !== $design['close_icon_alignment_x_mobile'] && $is_mobile_enabled ) ? $design['close_icon_alignment_x_mobile'] : $design['close_icon_alignment_x']; |
| 28 | $alignment_y = $design['close_icon_alignment_y']; |
| 29 | $alignment_y_mobile = ( '' !== $design['close_icon_alignment_y_mobile'] && $is_mobile_enabled ) ? $design['close_icon_alignment_y_mobile'] : $design['close_icon_alignment_y']; |
| 30 | |
| 31 | if ( ! $is_embed && ! $is_vanilla ) { |
| 32 | |
| 33 | $style .= ''; |
| 34 | |
| 35 | $style .= $component . ' .hustle-icon-close:before {'; |
| 36 | $style .= 'font-size: inherit;'; |
| 37 | $style .= '}'; |
| 38 | |
| 39 | // Mobile styles. |
| 40 | $style .= $prefix_mobile . $component . ' {'; |
| 41 | $style .= 'color: ' . $color_default . ';'; |
| 42 | $style .= ( ! empty( $color_background ) && 'flat' !== $icon_style_mobile ) ? 'background: ' . $color_background . ';' : 'background: transparent;'; |
| 43 | $style .= ( 'circle' === $icon_style_mobile ) ? 'border-radius: 100%;' : 'border-radius: 0;'; |
| 44 | $style .= 'position: absolute;'; |
| 45 | $style .= 'z-index: 1;'; |
| 46 | $style .= ( 'hidden' === $position_mobile ) ? 'display: none;' : 'display: block;'; |
| 47 | $style .= 'width: ' . ( $close_icon_size_mobile + 20 ) . 'px;'; |
| 48 | $style .= 'height: ' . ( $close_icon_size_mobile + 20 ) . 'px;'; |
| 49 | |
| 50 | // Alignment x axis. |
| 51 | if ( 'center' === $alignment_x_mobile ) { |
| 52 | $style .= 'left: 50%;'; |
| 53 | $style .= 'right: auto;'; |
| 54 | $style .= 'transform: translateX(-50%);'; |
| 55 | } else { |
| 56 | if ( 'outside' === $position_mobile && 'center' === $alignment_y_mobile ) { |
| 57 | $style .= $alignment_x_mobile . ': -' . ( $close_icon_size_mobile + 20 ) . 'px;'; |
| 58 | } else { |
| 59 | $style .= $alignment_x_mobile . ': 0;'; |
| 60 | } |
| 61 | $style .= ( 'left' === $alignment_x_mobile ) ? 'right: auto;' : 'left: auto;'; |
| 62 | } |
| 63 | |
| 64 | // Alignment y axis. |
| 65 | if ( 'center' === $alignment_y_mobile ) { |
| 66 | $style .= 'top: 50%;'; |
| 67 | $style .= 'transform: ' . ( ( 'center' === $alignment_x_mobile ) ? 'translate(-50%, -50%);' : 'translateY(-50%);' ); |
| 68 | } else { |
| 69 | $style .= $alignment_y_mobile . ': 0;'; |
| 70 | $style .= ( 'top' === $alignment_y_mobile ) ? 'bottom: auto;' : 'top: auto;'; |
| 71 | } |
| 72 | |
| 73 | if ( 'center' !== $alignment_x_mobile && 'center' !== $alignment_y_mobile ) { |
| 74 | $style .= 'transform: unset;'; |
| 75 | } |
| 76 | |
| 77 | $style .= '}'; |
| 78 | |
| 79 | $style .= $prefix_mobile . $component . ' .hustle-icon-close {'; |
| 80 | $style .= 'font-size: ' . $close_icon_size_mobile . 'px;'; |
| 81 | $style .= '}'; |
| 82 | |
| 83 | $style .= $prefix_mobile . $component . ':hover {'; |
| 84 | $style .= 'color: ' . $color_hover . ';'; |
| 85 | $style .= '}'; |
| 86 | |
| 87 | $style .= $prefix_mobile . $component . ':focus {'; |
| 88 | $style .= 'color: ' . $color_focus . ';'; |
| 89 | $style .= '}'; |
| 90 | |
| 91 | // Desktop styles. |
| 92 | if ( $is_mobile_enabled ) { |
| 93 | $style .= $breakpoint . ' {'; |
| 94 | |
| 95 | $style .= $prefix_desktop . $component . ' .hustle-icon-close {'; |
| 96 | $style .= 'font-size: ' . $close_icon_size . 'px;'; |
| 97 | $style .= '}'; |
| 98 | |
| 99 | $style .= $prefix_desktop . $component . ' {'; |
| 100 | $style .= ( ! empty( $color_background ) && 'flat' !== $icon_style ) ? 'background: ' . $color_background . ';' : 'background: transparent;'; |
| 101 | $style .= ( 'circle' === $icon_style ) ? 'border-radius: 100%;' : 'border-radius: 0;'; |
| 102 | $style .= ( 'hidden' === $position ) ? 'display: none;' : 'display: block;'; |
| 103 | $style .= 'width: ' . ( $close_icon_size + 20 ) . 'px;'; |
| 104 | $style .= 'height: ' . ( $close_icon_size + 20 ) . 'px;'; |
| 105 | |
| 106 | // Alignment x axis. |
| 107 | if ( 'center' === $alignment_x ) { |
| 108 | $style .= 'left: 50%;'; |
| 109 | $style .= 'right: auto;'; |
| 110 | $style .= 'transform: translateX(-50%);'; |
| 111 | } else { |
| 112 | if ( 'outside' === $position && 'center' === $alignment_y ) { |
| 113 | $style .= $alignment_x . ': -' . ( $close_icon_size + 20 ) . 'px;'; |
| 114 | } else { |
| 115 | $style .= $alignment_x . ': 0;'; |
| 116 | } |
| 117 | $style .= ( 'left' === $alignment_x ) ? 'right: auto;' : 'left: auto;'; |
| 118 | } |
| 119 | |
| 120 | // Alignment y axis. |
| 121 | if ( 'center' === $alignment_y ) { |
| 122 | $style .= 'top: 50%;'; |
| 123 | $style .= 'transform: ' . ( ( 'center' === $alignment_x ) ? 'translate(-50%, -50%);' : 'translateY(-50%);' ); |
| 124 | } else { |
| 125 | $style .= $alignment_y . ': 0;'; |
| 126 | $style .= ( 'top' === $alignment_y ) ? 'bottom: auto;' : 'top: auto;'; |
| 127 | } |
| 128 | |
| 129 | if ( 'center' !== $alignment_x && 'center' !== $alignment_y ) { |
| 130 | $style .= 'transform: unset;'; |
| 131 | } |
| 132 | |
| 133 | $style .= '}'; |
| 134 | $style .= '}'; |
| 135 | } |
| 136 | } |
| 137 |