Adds font settings options to sections, metadata label and value.

This commit is contained in:
mateuswetah 2021-01-03 18:17:51 -03:00
parent c71b9e48f9
commit 7802fcbedb
15 changed files with 144 additions and 28 deletions

View File

@ -24,7 +24,8 @@ add_action( 'wp_enqueue_scripts', function () {
add_action('blocksy:global-dynamic-css:enqueue', function ($args) { add_action('blocksy:global-dynamic-css:enqueue', function ($args) {
blocksy_theme_get_dynamic_styles(array_merge([ blocksy_theme_get_dynamic_styles(array_merge([
'path' => get_stylesheet_directory() . '/global.php', 'path' => get_stylesheet_directory() . '/global.php',
'chunk' => 'global' 'chunk' => 'global',
'forced_call' => true
], $args)); ], $args));
}, 10, 3); }, 10, 3);
}); });

View File

@ -1,18 +1,14 @@
<?php <?php
if (! isset($prefix)) { $prefix = blocksy_manager()->screen->get_prefix();
$prefix = '';
} else {
$prefix = $prefix . '_';
}
blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [ blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [
'css' => $css, 'css' => $css,
'tablet_css' => $tablet_css, 'tablet_css' => $tablet_css,
'mobile_css' => $mobile_css, 'mobile_css' => $mobile_css,
'selector' => ".tainacan-item-section__metadata", 'selector' => blocksy_prefix_selector('.tainacan-item-section__metadata', $prefix),
'variableName' => 'column-width', 'variableName' => 'column-width',
'value' => get_theme_mod($prefix . '_metadata_columns', [ 'value' => get_theme_mod( $prefix . '_tainacan_metadata_columns', [
'mobile' => '200px', 'mobile' => '200px',
'tablet' => '300px', 'tablet' => '300px',
'desktop' => '400px', 'desktop' => '400px',
@ -20,4 +16,44 @@ blc_call_fnc(['fnc' => 'blocksy_output_responsive'], [
'unit' => '' 'unit' => ''
]); ]);
blc_call_fnc(['fnc' => 'blocksy_output_font_css'], [
'css' => $css,
'tablet_css' => $tablet_css,
'mobile_css' => $mobile_css,
'selector' => blocksy_prefix_selector('.tainacan-single-item-section', $prefix),
'font_value' => get_theme_mod($prefix . '_tainacan_single_item_section_font',
blocksy_typography_default_values([
'size' => '26px',
'variation' => 'n6',
'line-height' => '1.3'
])
)
]);
blc_call_fnc(['fnc' => 'blocksy_output_font_css'], [
'css' => $css,
'tablet_css' => $tablet_css,
'mobile_css' => $mobile_css,
'selector' => blocksy_prefix_selector('.tainacan-metadata-label', $prefix),
'font_value' => get_theme_mod($prefix . '_tainacan_metadata_label_font',
blocksy_typography_default_values([
'size' => '22px',
'variation' => 'n6',
'line-height' => '1.2'
])
)
]);
blc_call_fnc(['fnc' => 'blocksy_output_font_css'], [
'css' => $css,
'tablet_css' => $tablet_css,
'mobile_css' => $mobile_css,
'selector' => blocksy_prefix_selector('.tainacan-metadata-value', $prefix),
'font_value' => get_theme_mod($prefix . '_tainacan_metadata_value_font',
blocksy_typography_default_values([
'size' => '17px'
])
)
]);
?> ?>

View File

@ -5,7 +5,7 @@ if (! isset($prefix)) {
} }
$options = [ $options = [
$prefix . 'metadata_columns' => [ $prefix . 'tainacan_metadata_columns' => [
'label' => __( 'Metadata columns width', 'blocksy-tainacan' ), 'label' => __( 'Metadata columns width', 'blocksy-tainacan' ),
'type' => 'ct-slider', 'type' => 'ct-slider',
'value' => [ 'value' => [

View File

@ -24,6 +24,9 @@ $options = [
], false), ], false),
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-columns.php', [ blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-columns.php', [
'prefix' => $prefix 'prefix' => $prefix
], false),
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/metadata-typography.php', [
'prefix' => $prefix
], false) ], false)
] ]
] ]

View File

@ -0,0 +1,34 @@
<?php
if (! isset($prefix)) {
$prefix = '';
}
if (! isset($enabled)) {
$enabled = 'no';
}
$options = [
$prefix . 'tainacan_metadata_label_font' => [
'type' => 'ct-typography',
'label' => __( 'Metadata label', 'blocksy' ),
'value' => blocksy_typography_default_values([
'size' => '22px',
'variation' => 'n6',
'line-height' => '1.2'
]),
'divider' => 'top',
'sync' => blocksy_sync_single_post_container([
'prefix' => $prefix
])
],
$prefix . 'tainacan_metadata_value_font' => [
'type' => 'ct-typography',
'label' => __( 'Metadata value', 'blocksy' ),
'value' => blocksy_typography_default_values([
'size' => '17px'
]),
'sync' => blocksy_sync_single_post_container([
'prefix' => $prefix
])
],
];

View File

@ -20,6 +20,19 @@ $options = [
'prefix' => $prefix, 'prefix' => $prefix,
]), ]),
'inner-options' => [ 'inner-options' => [
$prefix . 'tainacan_single_item_section_font' => [
'type' => 'ct-typography',
'label' => __( 'Section labels font', 'blocksy' ),
'value' => blocksy_typography_default_values([
'size' => '26px',
'variation' => 'n6',
'line-height' => '1.3'
]),
'divider' => 'top',
'sync' => blocksy_sync_single_post_container([
'prefix' => $prefix
])
],
blocksy_rand_md5() => [ blocksy_rand_md5() => [
'type' => 'ct-condition', 'type' => 'ct-condition',
'condition' => [ 'condition' => [

View File

@ -235,6 +235,7 @@ body:not(.tainacan-admin-page) {
align-items: center; align-items: center;
background-color: var(--backgroundColor, #f8f9fb); background-color: var(--backgroundColor, #f8f9fb);
background-size: cover; background-size: cover;
background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
// We also apply this here as we want to keep the same style of the .theme-items-list // We also apply this here as we want to keep the same style of the .theme-items-list

View File

@ -291,6 +291,9 @@
// Metadata list ------------------------------------- // Metadata list -------------------------------------
.tainacan-item-section__metadata { .tainacan-item-section__metadata {
height: 100%; height: 100%;
-moz-column-width: var(--column-width, 400);
-webkit-column-width: var(--column-width, 400);
column-width: var(--column-width, 400);
div { div {
-webkit-column-break-inside: avoid; -webkit-column-break-inside: avoid;
@ -311,7 +314,7 @@
-moz-column-rule: none; -moz-column-rule: none;
-webkit-column-gap: 0; -webkit-column-gap: 0;
-webkit-column-rule: none; -webkit-column-rule: none;
column-gap: 4rem;; column-gap: 4rem;
column-rule: none; column-rule: none;
} }
@media only screen and (min-width: 1366px) { @media only screen and (min-width: 1366px) {
@ -341,6 +344,17 @@
p { p {
word-wrap: break-word; word-wrap: break-word;
} }
.tainacan-metadata-value {
font-family: var(--fontFamily);
font-size: var(--fontSize);
font-weight: var(--fontWeight);
font-style: var(--fontStyle, inherit);
line-height: var(--lineHeight);
letter-spacing: var(--letterSpacing);
text-transform: var(--textTransform);
-webkit-text-decoration: var(--textDecoration);
text-decoration: var(--textDecoration);
}
.tainacan-item-section__metadata-thumbnail img { .tainacan-item-section__metadata-thumbnail img {
border-radius: var(--borderRadius, 3px); border-radius: var(--borderRadius, 3px);
} }

View File

@ -269,6 +269,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
align-items: center; align-items: center;
background-color: var(--backgroundColor, #f8f9fb); background-color: var(--backgroundColor, #f8f9fb);
background-size: cover; background-size: cover;
background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
--tainacan-secondary: var(--paletteColor1, #3eaf7c); --tainacan-secondary: var(--paletteColor1, #3eaf7c);
--tainacan-primary: var(--formBorderInitialColor, #e0e5eb); --tainacan-primary: var(--formBorderInitialColor, #e0e5eb);
@ -553,7 +554,7 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
cursor: pointer; cursor: pointer;
word-break: break-all; word-break: break-all;
font-size: 0.875em; font-size: 0.875em;
max-width: 160px; max-width: 157px;
} }
@media only screen and (max-width: 380px) { @media only screen and (max-width: 380px) {
@ -637,6 +638,9 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
.tainacan-item-single .tainacan-item-section__metadata { .tainacan-item-single .tainacan-item-section__metadata {
height: 100%; height: 100%;
-moz-column-width: var(--column-width, 400);
-webkit-column-width: var(--column-width, 400);
column-width: var(--column-width, 400);
} }
.tainacan-item-single .tainacan-item-section__metadata div { .tainacan-item-single .tainacan-item-section__metadata div {
@ -702,6 +706,18 @@ body:not(.tainacan-admin-page) .tainacan-modal-content .modal-card-body {
word-wrap: break-word; word-wrap: break-word;
} }
.tainacan-item-single .tainacan-item-section__metadata .tainacan-metadata-value {
font-family: var(--fontFamily);
font-size: var(--fontSize);
font-weight: var(--fontWeight);
font-style: var(--fontStyle, inherit);
line-height: var(--lineHeight);
letter-spacing: var(--letterSpacing);
text-transform: var(--textTransform);
-webkit-text-decoration: var(--textDecoration);
text-decoration: var(--textDecoration);
}
.tainacan-item-single .tainacan-item-section__metadata .tainacan-item-section__metadata-thumbnail img { .tainacan-item-single .tainacan-item-section__metadata .tainacan-item-section__metadata-thumbnail img {
border-radius: var(--borderRadius, 3px); border-radius: var(--borderRadius, 3px);
} }

File diff suppressed because one or more lines are too long

2
style.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -58,12 +58,12 @@
<section class="tainacan-item-section tainacan-item-section--<?php echo ((get_theme_mod($prefix . '_gallery_mode', 'no') == 'no' ? 'attachments' : 'gallery')) ?>"> <section class="tainacan-item-section tainacan-item-section--<?php echo ((get_theme_mod($prefix . '_gallery_mode', 'no') == 'no' ? 'attachments' : 'gallery')) ?>">
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (get_theme_mod($prefix . '_gallery_mode', 'no') == 'no') && get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'blocksy-tainacan' )) != '' ) : ?> <?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (get_theme_mod($prefix . '_gallery_mode', 'no') == 'no') && get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'blocksy-tainacan' )) != '' ) : ?>
<h2 id="tainacan-item-attachments-label"> <h2 class="tainacan-single-item-section" id="tainacan-item-attachments-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'blocksy-tainacan' ) ) ); ?> <?php echo esc_html( get_theme_mod($prefix . '_section_attachments_label', __( 'Attachments', 'blocksy-tainacan' ) ) ); ?>
</h2> </h2>
<?php endif; ?> <?php endif; ?>
<?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (get_theme_mod($prefix . '_gallery_mode', 'no') == 'yes') && get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'blocksy-tainacan' )) != '') : ?> <?php if ( (get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes') && (get_theme_mod($prefix . '_gallery_mode', 'no') == 'yes') && get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'blocksy-tainacan' )) != '') : ?>
<h2 id="tainacan-item-documents-label"> <h2 class="tainacan-single-item-section" id="tainacan-item-documents-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'blocksy-tainacan' )) ); ?> <?php echo esc_html( get_theme_mod($prefix . '_section_documents_label', __( 'Documents', 'blocksy-tainacan' )) ); ?>
</h2> </h2>
<?php endif; ?> <?php endif; ?>

View File

@ -4,7 +4,7 @@
<?php if ( tainacan_has_document() && get_theme_mod($prefix . '_gallery_mode', 'no') != 'yes') : ?> <?php if ( tainacan_has_document() && get_theme_mod($prefix . '_gallery_mode', 'no') != 'yes') : ?>
<section class="tainacan-item-section tainacan-item-section--document"> <section class="tainacan-item-section tainacan-item-section--document">
<?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_document_label', __( 'Document', 'blocksy-tainacan' )) != '' ) : ?> <?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_document_label', __( 'Document', 'blocksy-tainacan' )) != '' ) : ?>
<h2 id="tainacan-item-document-label"> <h2 class="tainacan-single-item-section" id="tainacan-item-document-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_document_label', __( 'Document', 'blocksy-tainacan' ) ) ); ?> <?php echo esc_html( get_theme_mod($prefix . '_section_document_label', __( 'Document', 'blocksy-tainacan' ) ) ); ?>
</h2> </h2>
<?php endif; ?> <?php endif; ?>

View File

@ -4,30 +4,28 @@
<section class="tainacan-item-section tainacan-item-section--metadata"> <section class="tainacan-item-section tainacan-item-section--metadata">
<?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'blocksy-tainacan' )) != '' ) : ?> <?php if ( get_theme_mod($prefix . '_display_section_labels', 'yes') == 'yes' && get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'blocksy-tainacan' )) != '' ) : ?>
<h2 id="tainacan-item-metadata-label"> <h2 class="tainacan-single-item-section" id="tainacan-item-metadata-label">
<?php echo esc_html( get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'blocksy-tainacan' ) ) ); ?> <?php echo esc_html( get_theme_mod($prefix . '_section_metadata_label', __( 'Metadata', 'blocksy-tainacan' ) ) ); ?>
</h2> </h2>
<?php endif; ?> <?php endif; ?>
<div <div class="tainacan-item-section__metadata">
class="tainacan-item-section__metadata"
style="column-width: <?php echo get_theme_mod( $prefix . '_metadata_columns', ['mobile' => '200px', 'tablet' => '300px', 'desktop' => '400px' ] )['desktop'] ?>">
<?php if (has_post_thumbnail() && (get_theme_mod($prefix . '_show_thumbnail', 'no') === 'yes') ): ?> <?php if (has_post_thumbnail() && (get_theme_mod($prefix . '_show_thumbnail', 'no') === 'yes') ): ?>
<div class="tainacan-item-section__metadata-thumbnail"> <div class="tainacan-item-section__metadata-thumbnail">
<h3><?php _e( 'Thumbnail', 'blocksy-tainacan' ); ?></h3> <h3 class="tainacan-metadata-label"><?php _e( 'Thumbnail', 'blocksy-tainacan' ); ?></h3>
<p><?php the_post_thumbnail('tainacan-medium-full'); ?></p> <p class="tainacan-metadata-value"><?php the_post_thumbnail('tainacan-medium-full'); ?></p>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php do_action( 'blocksy-tainacan-single-item-metadata-begin' ); ?> <?php do_action( 'blocksy-tainacan-single-item-metadata-begin' ); ?>
<?php <?php
$args = array( $args = array(
'before_title' => '<div><h3>', 'before_title' => '<div><h3 class="tainacan-metadata-label">',
'after_title' => '</h3>', 'after_title' => '</h3>',
'before_value' => '<p>', 'before_value' => '<p class="tainacan-metadata-value">',
'after_value' => '</p></div>', 'after_value' => '</p></div>',
'exclude_title' => (get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no') 'exclude_title' => (get_theme_mod($prefix . '_show_title_metadata', 'yes') === 'no')
); );
tainacan_the_metadata( $args ); tainacan_the_metadata( $args );
?> ?>
<?php do_action( 'blocksy-tainacan-single-item-metadata-end' ); ?> <?php do_action( 'blocksy-tainacan-single-item-metadata-end' ); ?>
</div>" </div>
</section> </section>