Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRESS2 305 | Build Fonts Design Step #97

Merged
merged 22 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 0 additions & 80 deletions includes/Data/Colors.php

This file was deleted.

4 changes: 2 additions & 2 deletions includes/Data/Flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ final class Flows {
),

'typography' => array(
'fontFamilies' => array(),
'fontSizes' => array(),
'slug' => '',
'data' => array()
),

// This string will identify the Header Pattern
Expand Down
79 changes: 79 additions & 0 deletions includes/Data/Themes/Colors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace NewfoldLabs\WP\Module\Onboarding\Data\Themes;

final class Colors {


/**
* This contains the different color variations for the theme.
*
* @var string
*/
protected static $theme_colors = array(
'yith-wonder' => array(
'calm' => array(
'tertiary' => '#C7DBFF',
'secondary' => '#E6EBEE',
'primary' => '#1A4733',
'background' => '',
),
'cool' => array(
'tertiary' => '#C7DBFF',
'secondary' => '#EDF7FE',
'primary' => '#21447B',
'background' => '',
),
'warm' => array(
'tertiary' => '#FFEDED',
'secondary' => '#FEF7E8',
'primary' => '#7A3921',
'background' => '',
),
'radiant' => array(
'tertiary' => '#C7F0FF',
'secondary' => '#FEF4FB',
'primary' => '#63156A',
'background' => '',
),
'bold' => array(
'tertiary' => '#F2A3D6',
'secondary' => '#FFFBF5',
'primary' => '#09857C',
'background' => '',
),
'retro' => array(
'tertiary' => '#F2E6A2',
'secondary' => '#F5FFFF',
'primary' => '#096385',
'background' => '',
),
'professional' => array(
'tertiary' => '#A2C1F2',
'secondary' => '#F5FAFF',
'primary' => '#669933',
'background' => '',
),
),
);

/**
* Retrieves the active theme color variations.
*
* @return array|\WP_Error
*/
public static function get_colors_from_theme() {
$active_theme = ( \wp_get_theme() )->get( 'TextDomain' );
$pattern_slugs = self::$theme_colors[ $active_theme ];

if ( ! isset( $pattern_slugs ) ) {
return new \WP_Error(
'Theme Colors not found',
'No WordPress Colors are available for this theme.',
array( 'status' => 404 )
);
}

return $pattern_slugs;
}
}
218 changes: 218 additions & 0 deletions includes/Data/Themes/Fonts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
<?php

namespace NewfoldLabs\WP\Module\Onboarding\Data\Themes;

final class Fonts {

/**
* This contains the different font variations for the theme.
*
* @var string
*/
protected static $theme_fonts = array(
'yith-wonder' => array(
'modern-approachable' => array(
'label' => 'Modern & approachable',
'matches' => 'yith-wonder/theme-json',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--mulish)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--poppins)',
),
),
),
),
),
'strong-sleek' => array(
'label' => 'Strong & sleek',
'matches' => 'yith-wonder/styles/01-blue-shades',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--raleway)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--oswald)',
),
),
),
),
),
'stately-elevated' => array(
'label' => 'Stately & elevated',
'matches' => 'yith-wonder/styles/02-pink-shades',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--source-sans-pro)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--playfair)',
),
),
),
),
),
'typewriter-crisp-midcentury' => array(
'label' => 'Typewriter & crisp midcentury',
'matches' => 'yith-wonder/styles/03-orange-shades',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--jost)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--solway)',
),
),
),
),
),
'refined-traditional-newsletter' => array(
'label' => 'Refined traditional newsletter',
'matches' => 'yith-wonder/styles/04-black-shades',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--jost)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--merriweather)',
),
),
),
),
),
'bold-stamp-slab' => array(
'label' => 'Bold stamp & slab',
'matches' => 'yith-wonder/styles/05-red-shades',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--roboto-slab)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--changa-one)',
),
),
),
),
),
'fast-simple' => array(
'label' => 'Fast & Simple',
'matches' => 'newfold/onboarding-01',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--system)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--system)',
),
),
),
),
),
'timeless-traditional' => array(
'label' => 'Timeless & Traditional',
'matches' => 'newfold/onboarding-02',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--serif)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--serif)',
),
),
),
),
),
'sleek-sophisticated' => array(
'label' => 'Sleek & Sophisticated',
'matches' => 'newfold/onboarding-03',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--dm-sans)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--dm-sans)',
),
),
),
),
),
'clear-crisp' => array(
'label' => 'Clear & Crisp',
'matches' => 'newfold/onboarding-04',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--inter)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--inter)',
),
),
),
),
),
'retro-classy' => array(
'label' => 'Retro & Classy',
'matches' => 'newfold/onboarding-05',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--league-spartan)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--league-spartan)',
),
),
),
),
),
'defined-solid' => array(
'label' => 'Defined & Solid',
'matches' => 'newfold/onboarding-06',
'styles' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--roboto-slab)',
),
'blocks' => array(
'core/heading' => array(
'typography' => array(
'fontFamily' => 'var(--wp--preset--font-family--roboto-slab)',
),
),
),
),
),
),
);

/**
* Retrieves the active theme font variations.
*
* @return array|\WP_Error
*/
public static function get_fonts_from_theme() {
$active_theme = ( \wp_get_theme() )->get( 'TextDomain' );
return isset( self::$theme_fonts[ $active_theme ] ) ? self::$theme_fonts[ $active_theme ] : false;
}
}
Loading