From 3bbe4d0077c7acdf135ae84a686ac9099fc8bb6b Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Tue, 29 Aug 2017 14:09:59 -0300 Subject: [PATCH] Add custom colours. --- app/admin.php | 31 +++++++++ app/setup.php | 64 +++++++++++++++++++ resources/assets/scripts/routes/home.js | 2 +- resources/assets/styles/common/_global.scss | 24 +++++++ .../assets/styles/components/_buttons.scss | 35 +++++++--- resources/assets/styles/layouts/_footer.scss | 1 - resources/assets/styles/layouts/_pages.scss | 8 +-- resources/views/partials/footer.blade.php | 2 +- .../views/partials/front-page-block.blade.php | 4 +- .../partials/front-page-catalog.blade.php | 8 +-- 10 files changed, 155 insertions(+), 24 deletions(-) diff --git a/app/admin.php b/app/admin.php index c0fd494..7f5a053 100644 --- a/app/admin.php +++ b/app/admin.php @@ -14,6 +14,36 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize) bloginfo('name'); } ]); + $wp_customize->add_section('pb_network_colors', [ + 'title' => __('Color Scheme', 'aldine'), + 'priority' => 20, + ]); + $wp_customize->add_setting('pb_network_primary_color', [ + 'type' => 'option', + 'default' => '#b01109', + ]); + $wp_customize->add_control(new \WP_Customize_Color_Control( + $wp_customize, + 'pb_network_primary_color', + [ + 'label' => __('Primary Color', 'aldine'), + 'section' => 'pb_network_colors', + 'settings' => 'pb_network_primary_color', + ] + )); + $wp_customize->add_setting('pb_network_secondary_color', [ + 'type' => 'option', + 'default' => '#015d75', + ]); + $wp_customize->add_control(new \WP_Customize_Color_Control( + $wp_customize, + 'pb_network_secondary_color', + [ + 'label' => __('Secondary Color', 'aldine'), + 'section' => 'pb_network_colors', + 'settings' => 'pb_network_secondary_color', + ] + )); $wp_customize->add_section('pb_network_social', [ 'title' => __('Social Media', 'aldine'), 'priority' => 30, @@ -108,4 +138,5 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize) */ add_action('customize_preview_init', function () { wp_enqueue_script('aldine/customizer.js', asset_path('scripts/customizer.js'), ['customize-preview'], null, true); + wp_localize_script('aldine/customizer.js', 'SAGE_DIST_PATH', get_theme_file_uri() . '/dist/'); }); diff --git a/app/setup.php b/app/setup.php index f91d295..32618cc 100644 --- a/app/setup.php +++ b/app/setup.php @@ -159,3 +159,67 @@ add_action('after_setup_theme', function () { return ""; }); }); + +add_action('wp_head', function () { + $primary = get_option('pb_network_primary_color'); + $secondary = get_option('pb_network_secondary_color'); + if ($primary || $secondary) { ?> + + { - books.slick('slickAdd', `
+ books.slick('slickAdd', `

Fiction

${book.metadata.name}

About this book →

diff --git a/resources/assets/styles/common/_global.scss b/resources/assets/styles/common/_global.scss index 9bbf9e1..e1024e4 100644 --- a/resources/assets/styles/common/_global.scss +++ b/resources/assets/styles/common/_global.scss @@ -37,3 +37,27 @@ a { color: $brand-primary; text-decoration: none; } + +.primary { + color: $brand-primary; +} + +.bg-primary { + background-color: $brand-primary; +} + +.secondary { + color: $brand-secondary; +} + +.bg-secondary { + background-color: $brand-secondary; +} + +.b--primary { + border-color: $brand-primary; +} + +.b--secondary { + border-color: $brand-secondary; +} diff --git a/resources/assets/styles/components/_buttons.scss b/resources/assets/styles/components/_buttons.scss index 7724c71..6af6a18 100644 --- a/resources/assets/styles/components/_buttons.scss +++ b/resources/assets/styles/components/_buttons.scss @@ -4,9 +4,9 @@ height: 60px; margin-top: 2em; padding: 1.25em; - border: 2px solid $brand-primary; + border: 2px solid $black; border-radius: 3px; - background: $brand-primary; + background: $black; font-family: $font-family-sans-serif; font-size: em(16); font-weight: 600; @@ -20,7 +20,7 @@ &:hover, &:focus { background: $white; - color: $brand-primary; + color: $black; } &.button-wide { @@ -29,19 +29,38 @@ &.button-outline { background: $white; - color: $brand-primary; + color: $black; &:hover, &:focus { - background: $brand-primary; + background: $black; color: $white; } } + &.button-primary { + border-color: $brand-primary; + background: $brand-primary; + + &:hover, + &:focus { + background: $white; + color: $brand-primary; + } + + &.button-outline { + color: $brand-primary; + + &:hover, + &:focus { + background: $brand-primary; + } + } + } + &.button-secondary { - border: 2px solid $brand-secondary; + border-color: $brand-secondary; background: $brand-secondary; - color: $white; &:hover, &:focus { @@ -50,13 +69,11 @@ } &.button-outline { - background: $white; color: $brand-secondary; &:hover, &:focus { background: $brand-secondary; - color: $white; } } } diff --git a/resources/assets/styles/layouts/_footer.scss b/resources/assets/styles/layouts/_footer.scss index e554381..66156ed 100644 --- a/resources/assets/styles/layouts/_footer.scss +++ b/resources/assets/styles/layouts/_footer.scss @@ -1,6 +1,5 @@ .content-info { .network-footer { - background: $brand-secondary; margin-bottom: 0; padding: 60px 42.5px 40px; font-family: $font-family-sans-serif; diff --git a/resources/assets/styles/layouts/_pages.scss b/resources/assets/styles/layouts/_pages.scss index 9d90115..300115d 100644 --- a/resources/assets/styles/layouts/_pages.scss +++ b/resources/assets/styles/layouts/_pages.scss @@ -8,7 +8,6 @@ font-weight: 600; letter-spacing: 2px; line-height: (36/30); - color: $brand-primary; margin: 0; &::before { @@ -41,8 +40,6 @@ .navigation { a { - color: $brand-secondary; - &.slick-disabled { opacity: 0; } @@ -57,8 +54,7 @@ height: 386px; margin: 45px 0 0; padding: 0 29.5px; - border: solid 2px $brand-secondary; - background-color: $brand-secondary; + border: solid 2px; a { font-family: $font-family-sans-serif; @@ -120,7 +116,7 @@ width: 100vw; height: 600px; z-index: -1; - background: url('../images/banner-two.jpg'); + // background: url('../images/banner-two.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover; diff --git a/resources/views/partials/footer.blade.php b/resources/views/partials/footer.blade.php index a8936b5..2d98041 100644 --- a/resources/views/partials/footer.blade.php +++ b/resources/views/partials/footer.blade.php @@ -1,6 +1,6 @@