Refined responsive table styles

This commit is contained in:
Justin Foell
2020-11-27 11:17:53 -06:00
parent 620d22a15c
commit c67629a0d6
3 changed files with 29 additions and 0 deletions
+4
View File
@@ -70,6 +70,10 @@ only screen and (max-width: 760px),
content: attr(data-label);
}
.activity-details-table td {
text-align: right;
}
.activity-details-table-info, .activity-details-table-units {
display: inline;
}
+1
View File
@@ -118,6 +118,7 @@ On the WP-Strava settings page you cannot currently remove and add another athle
= 2.5.0 =
Fix missing translation domain on "Save Changes" in settings. https://wordpress.org/support/topic/small-fix-in-settings-php-function-print_clear_input
Refined styles for responsive tables https://wordpress.org/support/topic/responsive-strava-activity-table/
= 2.4.0 =
+24
View File
@@ -5,6 +5,15 @@
class WPStrava_Blocks_Activity implements WPStrava_Blocks_Interface {
/**
* Whether or not to enqueue styles (if shortcode is present).
*
* @var boolean
* @author Justin Foell <justin@foell.org>
* @since 2.5.0
*/
private $add_script = false;
/**
* Register the wp-strava/activity block.
*
@@ -21,6 +30,7 @@ class WPStrava_Blocks_Activity implements WPStrava_Blocks_Interface {
'render_callback' => array( $this, 'render_block' ),
)
);
add_action( 'wp_footer', array( $this, 'print_scripts' ) );
}
/**
@@ -37,6 +47,8 @@ class WPStrava_Blocks_Activity implements WPStrava_Blocks_Interface {
return $content;
}
$this->add_script = true;
$matches = [];
preg_match( '/\/activities\/([0-9].*)$/', $attributes['url'], $matches );
if ( $matches[1] ) {
@@ -52,4 +64,16 @@ class WPStrava_Blocks_Activity implements WPStrava_Blocks_Interface {
}
return $content;
}
/**
* Enqueue style if shortcode is being used.
*
* @author Justin Foell <justin@foell.org>
* @since 2.5.0
*/
public function print_scripts() {
if ( $this->add_script ) {
wp_enqueue_style( 'wp-strava-style' );
}
}
}