Skip to content

Commit

Permalink
Merge pull request #2 from newfold-labs/add/chapters-helper
Browse files Browse the repository at this point in the history
Update code with trunk of Onboarding
  • Loading branch information
arunshenoy99 authored Sep 11, 2023
2 parents 6ad713a + 3aa43d2 commit 02e4a1b
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 291 deletions.
2 changes: 1 addition & 1 deletion includes/Brands.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public static function set_current_brand( $container ) {
if ( ! defined( 'NFD_ONBOARDING_PLUGIN_BRAND' ) ) {
$brand = $container->plugin()->brand;
if ( empty( $brand ) ) {
$brand = 'WordPress';
$brand = 'wordpress';
}
define( 'NFD_ONBOARDING_PLUGIN_BRAND', sanitize_title_with_dashes( str_replace( '_', '-', $brand ) ) );
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function current_plan() {
if ( false !== $current_flow ) {
return array(
'flow' => $current_flow,
'subtype' => Flows::is_commerce_priority() ? 'wc_priority' : null,
'subtype' => 'wc_priority',
'type' => null,
);
}
Expand Down
9 changes: 4 additions & 5 deletions includes/Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@ protected static function get_theme_step_patterns() {
'site-pages' => array(
'company-page' => array(
'active' => true,
'title' => 'About',
'title' => __( 'About', 'wp-module-onboarding' ),
'selected' => true,
'shown' => true,
'description' => __( 'Explain your company values or the history behind your brand.', 'wp-module-onboarding' ),
),
'contact-us' => array(
'active' => true,
'selected' => true,
'title' => 'Contact',
'title' => __( 'Contact', 'wp-module-onboarding' ),
'shown' => true,
'description' => __( 'Offer visitors a single page with a contact form, your street address and social media.', 'wp-module-onboarding' ),
),
'testimonials-page' => array(
'active' => true,
'title' => 'Testimonials',
'title' => __( 'Testimonials', 'wp-module-onboarding' ),
'selected' => false,
'shown' => true,
'description' => __( 'Highlight your success with testimonials from your fans.', 'wp-module-onboarding' ),
),
'blog-page' => array(
'active' => true,
'selected' => true,
'title' => 'Blog',
'title' => __( 'Blog', 'wp-module-onboarding' ),
'shown' => true,
'description' => __( 'A page for periodic news, announcements and ideas.', 'wp-module-onboarding' ),
),
Expand Down Expand Up @@ -358,7 +358,6 @@ public static function get_theme_step_patterns_from_step( $step, $squash = false
}

$pattern_slugs = self::get_theme_step_patterns()[ $active_theme ][ $step ];

$block_patterns = $squash ? '' : array();

foreach ( array_keys( $pattern_slugs ) as $pattern_slug ) {
Expand Down
285 changes: 149 additions & 136 deletions includes/Themes/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,144 +14,157 @@ final class Colors {
*
* @var string
*/
protected static $theme_colors = array(
'yith-wonder' => array(
'tailored' => array(
'calm' => array(
'header-background' => '#1A4733',
'header-foreground' => '#FFFFFF',
'header-titles' => '#FFFFFF',
'secondary-background' => '#1A4733',
'secondary-foreground' => '#FFF',
'tertiary' => '#C7DBFF',
'secondary' => '#344A77',
'primary' => '#1A4733',
'base' => '#FFFFFF',
protected static function get_theme_colors() {
return array(
'yith-wonder' => array(
'tailored' => array(
'calm' => array(
'header-background' => '#1A4733',
'header-foreground' => '#FFFFFF',
'header-titles' => '#FFFFFF',
'secondary-background' => '#1A4733',
'secondary-foreground' => '#FFF',
'tertiary' => '#C7DBFF',
'secondary' => '#344A77',
'primary' => '#1A4733',
'base' => '#FFFFFF',
'name' => __( 'Calm', 'wp-module-onboarding' ),
),
'cool' => array(
'header-background' => '#C7DBFF',
'header-foreground' => '#21447B',
'header-titles' => '#21447B',
'secondary-background' => '#C7DBFF',
'secondary-foreground' => '#21447B',
'tertiary' => '#C7DBFF',
'secondary' => '#3764B4',
'primary' => '#21447B',
'base' => '#FFFFFF',
'name' => __( 'Cool', 'wp-module-onboarding' ),
),
'warm' => array(
'header-background' => '#FDE5D0',
'header-foreground' => '#7A3921',
'header-titles' => '#7A3921',
'secondary-background' => '#FDE5D0',
'secondary-foreground' => '#7A3921',
'tertiary' => '#FFEDED',
'secondary' => '#B97040',
'primary' => '#7A3921',
'base' => '#FFFFFF',
'name' => __( 'Warm', 'wp-module-onboarding' ),
),
'radiant' => array(
'header-background' => '#63156A',
'header-foreground' => '#E3F7FF',
'header-titles' => '#E3F7FF',
'secondary-background' => '#781980',
'secondary-foreground' => '#E3F7FF',
'tertiary' => '#C7F0FF',
'secondary' => '#64288C',
'primary' => '#63156A',
'base' => '#FFFFFF',
'name' => __( 'Radiant', 'wp-module-onboarding' ),
),
'bold' => array(
'header-background' => '#FFD7F1',
'header-foreground' => '#09857C',
'header-titles' => '#09857C',
'secondary-background' => '#ffddf3',
'secondary-foreground' => '#09857C',
'tertiary' => '#F2A3D6',
'secondary' => '#076D66',
'primary' => '#09857C',
'base' => '#FFFFFF',
'name' => __( 'Bold', 'wp-module-onboarding' ),
),
'retro' => array(
'header-background' => '#096385',
'header-foreground' => '#F2E6A2',
'header-titles' => '#F2E6A2',
'secondary-background' => '#096385',
'secondary-foreground' => '#F2E6A2',
'tertiary' => '#F2E6A2',
'secondary' => '#BE9E00',
'primary' => '#096385',
'base' => '#FFFFFF',
'name' => __( 'Retro', 'wp-module-onboarding' ),
),
'professional' => array(
'header-background' => '#6D8258',
'header-foreground' => '#F5FAFF',
'header-titles' => '#D2E0F5',
'secondary-background' => '#6D8258',
'secondary-foreground' => '#F5FAFF',
'tertiary' => '#d6e4f9',
'secondary' => '#405F1C',
'primary' => '#558320',
'base' => '#FFFFFF',
'name' => __( 'Professional', 'wp-module-onboarding' ),
),
'crisp' => array(
'header-background' => '#ccc',
'header-foreground' => '#333',
'header-titles' => '#234',
'secondary-background' => '#ccc',
'secondary-foreground' => '#333',
'tertiary' => '#777',
'secondary' => '#17222E',
'primary' => '#223344',
'base' => '#FFFFFF',
'name' => __( 'Crisp', 'wp-module-onboarding' ),
),
'polished' => array(
'header-background' => '#313131',
'header-foreground' => '#fff',
'header-titles' => '#6B69EA',
'secondary-background' => '#444',
'secondary-foreground' => '#ddd',
'tertiary' => '#313131',
'secondary' => '#6B69EA',
'primary' => '#5100FA',
'base' => '#FFFFFF',
'name' => __( 'Polished', 'wp-module-onboarding' ),
),
'nightowl' => array(
'header-background' => '#06080A',
'header-foreground' => '#fff',
'header-titles' => '#FAAA14',
'secondary-background' => '#0A0C0E',
'secondary-foreground' => '#fff',
'tertiary' => '#FFDFA3',
'secondary' => '#06080A',
'primary' => '#B97900',
'base' => '#FFFFFF',
'name' => __( 'Nightowl', 'wp-module-onboarding' ),
),
'subtle' => array(
'header-background' => '#C7ADBB',
'header-foreground' => '#5A3C4B',
'header-titles' => '#5A3C4B',
'secondary-background' => '#C7ADBB',
'secondary-foreground' => '#5A3C4B',
'tertiary' => '#D4C9CF',
'secondary' => '#57203c',
'primary' => '#5A3C4B',
'base' => '#FFFFFF',
'name' => __( 'Subtle', 'wp-module-onboarding' ),
),
),
'cool' => array(
'header-background' => '#C7DBFF',
'header-foreground' => '#21447B',
'header-titles' => '#21447B',
'secondary-background' => '#C7DBFF',
'secondary-foreground' => '#21447B',
'tertiary' => '#C7DBFF',
'secondary' => '#3764B4',
'primary' => '#21447B',
'base' => '#FFFFFF',
),
'warm' => array(
'header-background' => '#FDE5D0',
'header-foreground' => '#7A3921',
'header-titles' => '#7A3921',
'secondary-background' => '#FDE5D0',
'secondary-foreground' => '#7A3921',
'tertiary' => '#FFEDED',
'secondary' => '#B97040',
'primary' => '#7A3921',
'base' => '#FFFFFF',
),
'radiant' => array(
'header-background' => '#63156A',
'header-foreground' => '#E3F7FF',
'header-titles' => '#E3F7FF',
'secondary-background' => '#781980',
'secondary-foreground' => '#E3F7FF',
'tertiary' => '#C7F0FF',
'secondary' => '#64288C',
'primary' => '#63156A',
'base' => '#FFFFFF',
),
'bold' => array(
'header-background' => '#FFD7F1',
'header-foreground' => '#09857C',
'header-titles' => '#09857C',
'secondary-background' => '#ffddf3',
'secondary-foreground' => '#09857C',
'tertiary' => '#F2A3D6',
'secondary' => '#076D66',
'primary' => '#09857C',
'base' => '#FFFFFF',
),
'retro' => array(
'header-background' => '#096385',
'header-foreground' => '#F2E6A2',
'header-titles' => '#F2E6A2',
'secondary-background' => '#096385',
'secondary-foreground' => '#F2E6A2',
'tertiary' => '#F2E6A2',
'secondary' => '#BE9E00',
'primary' => '#096385',
'base' => '#FFFFFF',
),
'professional' => array(
'header-background' => '#6D8258',
'header-foreground' => '#F5FAFF',
'header-titles' => '#D2E0F5',
'secondary-background' => '#6D8258',
'secondary-foreground' => '#F5FAFF',
'tertiary' => '#d6e4f9',
'secondary' => '#405F1C',
'primary' => '#558320',
'base' => '#FFFFFF',
),
'crisp' => array(
'header-background' => '#ccc',
'header-foreground' => '#333',
'header-titles' => '#234',
'secondary-background' => '#ccc',
'secondary-foreground' => '#333',
'tertiary' => '#777',
'secondary' => '#17222E',
'primary' => '#223344',
'base' => '#FFFFFF',
),
'polished' => array(
'header-background' => '#313131',
'header-foreground' => '#fff',
'header-titles' => '#6B69EA',
'secondary-background' => '#444',
'secondary-foreground' => '#ddd',
'tertiary' => '#313131',
'secondary' => '#6B69EA',
'primary' => '#5100FA',
'base' => '#FFFFFF',
),
'nightowl' => array(
'header-background' => '#06080A',
'header-foreground' => '#fff',
'header-titles' => '#FAAA14',
'secondary-background' => '#0A0C0E',
'secondary-foreground' => '#fff',
'tertiary' => '#FFDFA3',
'secondary' => '#06080A',
'primary' => '#B97900',
'base' => '#FFFFFF',
),
'subtle' => array(
'header-background' => '#C7ADBB',
'header-foreground' => '#5A3C4B',
'header-titles' => '#5A3C4B',
'secondary-background' => '#C7ADBB',
'secondary-foreground' => '#5A3C4B',
'tertiary' => '#D4C9CF',
'secondary' => '#57203c',
'primary' => '#5A3C4B',
'base' => '#FFFFFF',
),
),
'custom-picker-grouping' => array(
'base' => array(
'header-foreground',
'header-titles',
'secondary-foreground',
),
'tertiary' => array(
'header-background',
'secondary-background',
'custom-picker-grouping' => array(
'base' => array(
'header-foreground',
'header-titles',
'secondary-foreground',
),
'tertiary' => array(
'header-background',
'secondary-background',
),
),
),
),
);
);
}

/**
* Retrieves the active theme color variations.
Expand All @@ -160,7 +173,7 @@ final class Colors {
*/
public static function get_colors_from_theme() {
$active_theme = Themes::get_active_theme();
$pattern_slugs = self::$theme_colors[ $active_theme ];
$pattern_slugs = self::get_theme_colors()[ $active_theme ];

if ( ! isset( $pattern_slugs ) ) {
return new \WP_Error(
Expand Down
Loading

0 comments on commit 02e4a1b

Please sign in to comment.