| @@ -7,11 +7,10 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace Timetics\Core\EnqueueInline; |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; | |
| 12 | - | |
| 13 | 11 | use Timetics\Utils\Singleton; |
| 12 | +use Timetics; | |
| 14 | 13 | |
| 15 | 14 | /** |
| 16 | 15 | * Class Enqueue_Inline |
| 17 | 16 | */ |
| @@ -19,13 +18,8 @@ | ||
| 19 | 18 | { |
| 20 | 19 | use Singleton; |
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | - * Template path for dynamic color CSS. | |
| 24 | - */ | |
| 25 | - const COLOR_TEMPLATE = __DIR__ . '/templates/dynamic-colors.php'; | |
| 26 | - | |
| 27 | - /** | |
| 28 | 22 | * Initialize the shortcode class |
| 29 | 23 | * |
| 30 | 24 | * @return void |
| 31 | 25 | */ |
| @@ -30,52 +24,113 @@ | ||
| 30 | 24 | * @return void |
| 31 | 25 | */ |
| 32 | 26 | public function init() |
| 33 | 27 | { |
| 34 | - add_action( 'wp_enqueue_scripts', array( $this, 'custom_inline_css' ), 20 ); | |
| 28 | + add_action('wp_head', array($this, 'custom_inline_css')); | |
| 35 | 29 | } |
| 36 | 30 | |
| 37 | 31 | /** |
| 38 | - * Build and attach the dynamic color CSS to the frontend stylesheet. | |
| 32 | + * Custom inline css | |
| 39 | 33 | */ |
| 40 | 34 | public function custom_inline_css() |
| 41 | 35 | { |
| 42 | - $primary_color = timetics_get_option( 'primary_color' ); | |
| 43 | - $secondary_color = timetics_get_option( 'secondary_color' ); | |
| 36 | + $custom_css = ''; | |
| 37 | + $primary_color = timetics_get_option('primary_color'); | |
| 38 | + $secondary_color = timetics_get_option('secondary_color'); | |
| 44 | 39 | |
| 45 | - if ( empty( $primary_color ) && empty( $secondary_color ) ) { | |
| 46 | - return; | |
| 40 | + $custom_css .= " | |
| 41 | + .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn, | |
| 42 | + .ant-btn-background-ghost.ant-btn-primary, | |
| 43 | + .ant-spin, | |
| 44 | + .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled), | |
| 45 | + .ant-radio-button-wrapper:hover { | |
| 46 | + color: {$primary_color}; | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $custom_css = $this->render_color_css( $primary_color, $secondary_color ); | |
| 49 | + .flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange, | |
| 50 | + .ant-spin .ant-spin-dot-item, | |
| 51 | + .flatpickr-day.selected.inRange, .flatpickr-day.startRange.inRange, .flatpickr-day.endRange.inRange, .flatpickr-day.selected:focus, .flatpickr-day.startRange:focus, .flatpickr-day.endRange:focus, .flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover, .flatpickr-day.selected.prevMonthDay, .flatpickr-day.startRange.prevMonthDay, .flatpickr-day.endRange.prevMonthDay, .flatpickr-day.selected.nextMonthDay, .flatpickr-day.startRange.nextMonthDay, .flatpickr-day.endRange.nextMonthDay, | |
| 52 | + .ant-btn-primary{ | |
| 53 | + background-color: {$primary_color}; | |
| 54 | + } | |
| 50 | 55 | |
| 51 | - if ( '' === trim( $custom_css ) ) { | |
| 52 | - return; | |
| 56 | + | |
| 57 | + .ant-btn-background-ghost.ant-btn-primary, | |
| 58 | + .ant-btn-primary, | |
| 59 | + .ant-input-focused, .ant-input:focus, | |
| 60 | + .ant-input:hover, | |
| 61 | + .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled), | |
| 62 | + .flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange, .flatpickr-day.selected.inRange, .flatpickr-day.startRange.inRange, .flatpickr-day.endRange.inRange, .flatpickr-day.selected:focus, .flatpickr-day.startRange:focus, .flatpickr-day.endRange:focus, .flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover, .flatpickr-day.selected.prevMonthDay, .flatpickr-day.startRange.prevMonthDay, .flatpickr-day.endRange.prevMonthDay, .flatpickr-day.selected.nextMonthDay, .flatpickr-day.startRange.nextMonthDay, .flatpickr-day.endRange.nextMonthDay{ | |
| 63 | + border-color: {$primary_color}; | |
| 53 | 64 | } |
| 54 | 65 | |
| 55 | - wp_register_style( 'timetics-custom-css', false, array(), TIMETICS_VERSION ); | |
| 56 | - wp_enqueue_style( 'timetics-custom-css' ); | |
| 57 | - wp_add_inline_style( 'timetics-frontend', $custom_css ); | |
| 58 | - } | |
| 66 | + .tt-form-left-sidebar .ant-space-item svg, | |
| 67 | + .tt-form-category-sidebar .ant-space-item svg, | |
| 68 | + .anticon svg, | |
| 69 | + .meeting-info-list li svg, | |
| 70 | + .tt-form-left-sidebar .tt-meeting-location-list .anticon svg , | |
| 71 | + .tt-form-category-sidebar .tt-meeting-location-list .anticon svg{ | |
| 72 | + fill: {$primary_color}; | |
| 73 | + } | |
| 59 | 74 | |
| 60 | - /** | |
| 61 | - * Render the CSS template with the given colors. | |
| 62 | - * | |
| 63 | - * @param string $primary_color | |
| 64 | - * @param string $secondary_color | |
| 65 | - * | |
| 66 | - * @return string | |
| 67 | - */ | |
| 68 | - protected function render_color_css( $primary_color, $secondary_color ) | |
| 69 | - { | |
| 70 | - if ( ! file_exists( self::COLOR_TEMPLATE ) ) { | |
| 71 | - return ''; | |
| 75 | + .ant-btn-background-ghost.ant-btn-primary:focus, .ant-btn-background-ghost.ant-btn-primary:hover, | |
| 76 | + button.ant-btn.ant-btn-default.ant-btn-lg.tt-mb-30:hover{ | |
| 77 | + color: {$secondary_color}; | |
| 72 | 78 | } |
| 73 | 79 | |
| 74 | - $primary_color = sanitize_hex_color( $primary_color ) ?: $primary_color; | |
| 75 | - $secondary_color = sanitize_hex_color( $secondary_color ) ?: $secondary_color; | |
| 80 | + .ant-btn-background-ghost.ant-btn-primary:focus, .ant-btn-background-ghost.ant-btn-primary:hover, | |
| 81 | + .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled), | |
| 82 | + button.ant-btn.ant-btn-default.ant-btn-lg.tt-mb-30:hover, | |
| 83 | + .ant-btn-primary:focus, .ant-btn-primary:hover{ | |
| 84 | + border-color: {$secondary_color}; | |
| 85 | + } | |
| 76 | 86 | |
| 77 | - ob_start(); | |
| 78 | - include self::COLOR_TEMPLATE; | |
| 79 | - return ob_get_clean(); | |
| 87 | + .ant-btn-primary:focus, | |
| 88 | + .ant-btn-primary:hover{ | |
| 89 | + background-color: {$secondary_color}; | |
| 90 | + } | |
| 91 | + | |
| 92 | + .toplevel_page_timetics .ant-btn.ant-btn-primary { | |
| 93 | + background: {$primary_color}; | |
| 94 | + border-color: {$primary_color}; | |
| 95 | + } | |
| 96 | + | |
| 97 | + .tt-slot-list .ant-list-item .ant-btn-block:hover { | |
| 98 | + color: {$primary_color}; | |
| 99 | + border-color: {$primary_color}; | |
| 100 | + } | |
| 101 | + | |
| 102 | + .tt-form-left-sidebar .submit-btn, | |
| 103 | + .tt-form-category-sidebar .submit-btn, | |
| 104 | + .tt-booking-body-wrap .submit-btn, | |
| 105 | + .tt-category-booking-wrap .submit-btn, | |
| 106 | + .tt-flatpickr-calendar .flatpickr-day.selected, | |
| 107 | + .toplevel_page_timetics .tt-flatpickr-calendar .flatpickr-day.selected { | |
| 108 | + background: {$primary_color}; | |
| 109 | + } | |
| 110 | + | |
| 111 | + .toplevel_page_timetics .ant-btn.ant-btn-primary:hover, | |
| 112 | + .toplevel_page_timetics .ant-btn.ant-btn-primary:focus, | |
| 113 | + .tt-form-left-sidebar .submit-btn:hover, | |
| 114 | + .tt-form-left-sidebar .submit-btn:focus, | |
| 115 | + .tt-form-category-sidebar .submit-btn:hover, | |
| 116 | + .tt-form-category-sidebar .submit-btn:focus, | |
| 117 | + .tt-booking-body-wrap .submit-btn:hover, | |
| 118 | + .tt-booking-body-wrap .submit-btn:focus, | |
| 119 | + .tt-category-booking-wrap .submit-btn:hover, | |
| 120 | + .tt-category-booking-wrap .submit-btn:focus { | |
| 121 | + background: {$secondary_color}; | |
| 122 | + } | |
| 123 | + | |
| 124 | + .tt-form-left-sidebar .tt-meeting-location-list .anticon.tt-money-icon svg path , | |
| 125 | + .tt-form-category-sidebar .tt-meeting-location-list .anticon.tt-money-icon svg path { | |
| 126 | + stroke: {$primary_color}; | |
| 127 | + } | |
| 128 | + | |
| 129 | + "; | |
| 130 | + | |
| 131 | + // add inline css. | |
| 132 | + wp_register_style('timetics-custom-css', false); | |
| 133 | + wp_enqueue_style('timetics-custom-css'); | |
| 134 | + wp_add_inline_style('timetics-frontend', $custom_css); | |
| 80 | 135 | } |
| 81 | 136 | } |