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

feat: update reader registration block to use newspack-ui #3199

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e25e636
feat: update reader registration block to use newspack-ui
thomasguillot Jun 25, 2024
00ef57c
feat(newspack-ui): replace Inter font; enqueue styles in editor
thomasguillot Jun 25, 2024
1afb97f
feat(reader-registration): display state-bar only when block is selected
thomasguillot Jun 25, 2024
649d36f
chore: merge epic/ras-acc into update/reader-registration-block
thomasguillot Jul 16, 2024
2892c08
style(reader-registration): add missing keyframes
thomasguillot Jul 16, 2024
66f6d85
Merge epic/ras-acc into update/reader-registration-block
thomasguillot Jul 16, 2024
a81a120
feat(reader-registration): add missing newspack-ui class to submit bu…
thomasguillot Jul 16, 2024
4c16b57
feat(reader-registration): move third party before registration inputs
thomasguillot Jul 16, 2024
ec367b2
feat(reader-registration): improve editor styles for the success message
thomasguillot Jul 16, 2024
ce618ed
chore: rename assets to src
adekbadek Aug 16, 2024
643c992
Merge branch 'epic/ras-acc' into update/reader-registration-block
adekbadek Aug 16, 2024
4ed74df
style: autofix with stylelint
adekbadek Aug 16, 2024
4b86fd1
chore: remove duplicated files
adekbadek Aug 16, 2024
b55cdf5
chore: remove unused files
adekbadek Aug 16, 2024
ba94c65
Merge branch 'epic/ras-acc' into update/reader-registration-block
adekbadek Sep 6, 2024
95f1bd6
fix: heading styles when overriden in the editor
adekbadek Sep 6, 2024
9a43547
revert: src/components changes
adekbadek Sep 6, 2024
5127d5e
refactor: remove unused classname
adekbadek Sep 6, 2024
68f3faa
Apply suggestions from code review
adekbadek Oct 7, 2024
1585d89
Update src/newspack-ui/scss/elements/forms/_checkbox-radio.scss
adekbadek Oct 7, 2024
d388011
chore: add some comments
adekbadek Oct 7, 2024
96afca6
fix: reader registration title size
adekbadek Oct 9, 2024
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
1 change: 1 addition & 0 deletions includes/class-newspack-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Newspack_UI {
*/
public static function init() {
\add_action( 'wp_enqueue_scripts', [ __CLASS__, 'enqueue_styles' ] );
\add_action( 'enqueue_block_editor_assets', [ __CLASS__, 'enqueue_styles' ] );
\add_filter( 'the_content', [ __CLASS__, 'load_demo' ] );
// Only run if the site is using a block theme.
if ( wp_theme_has_theme_json() ) {
Expand Down
66 changes: 31 additions & 35 deletions includes/reader-activation/class-reader-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ private static function render_newsletters_signup_form( $email_address, $newslet
foreach ( $newsletters_lists as $list ) {
$checkbox_id = sprintf( 'newspack-plugin-list-%s', $list['id'] );
?>
<label class="newspack-ui__input-card">
<label class="newspack-ui__input-card" for="<?php echo \esc_attr( $checkbox_id ); ?>">
<input
type="checkbox"
name="lists[]"
Expand Down Expand Up @@ -1643,47 +1643,43 @@ public static function render_subscription_lists_inputs( $lists = [], $checked =

$checked_map = array_flip( $checked );
?>
<div class="<?php echo \esc_attr( $class() ); ?>">
<?php if ( 1 < count( $lists ) && ! empty( $config['title'] ) ) : ?>
<h3><?php echo \esc_html( $config['title'] ); ?></h3>
<h3 class="screen-reader-text"><?php echo \esc_html( $config['title'] ); ?></h3>
<?php endif; ?>
<?php if ( ! $config['show_description'] ) : ?>
<div class="newspack-ui__box newspack-ui__box--border">
<?php endif; ?>
<ul>
<?php
foreach ( $lists as $list_id => $list ) :
$checkbox_id = sprintf( 'newspack-%s-list-checkbox-%s', $id, $list_id );
?>
<li>
<span class="<?php echo \esc_attr( $class( 'checkbox' ) ); ?>">
<input
type="checkbox"
name="<?php echo \esc_attr( $config['name'] ); ?>[]"
value="<?php echo \esc_attr( $list_id ); ?>"
id="<?php echo \esc_attr( $checkbox_id ); ?>"
<?php if ( isset( $checked_map[ $list_id ] ) ) : ?>
checked
<?php endif; ?>
/>
</span>
<span class="<?php echo \esc_attr( $class( 'details' ) ); ?>">
<label class="<?php echo \esc_attr( $class( 'label' ) ); ?>" for="<?php echo \esc_attr( $checkbox_id ); ?>">
<span class="<?php echo \esc_attr( $class( 'title' ) ); ?>">
<?php
if ( 1 === count( $lists ) ) {
echo \wp_kses_post( $config['single_label'] );
} else {
echo \esc_html( $list['title'] );
}
?>
</span>
<?php if ( $config['show_description'] ) : ?>
<span class="<?php echo \esc_attr( $class( 'description' ) ); ?>"><?php echo \esc_html( $list['description'] ); ?></span>
<?php endif; ?>
</label>
</span>
</li>
<label class="newspack-ui__input-card" for="<?php echo \esc_attr( $checkbox_id ); ?>">
<input
type="checkbox"
name="<?php echo \esc_attr( $config['name'] ); ?>[]"
value="<?php echo \esc_attr( $list_id ); ?>"
id="<?php echo \esc_attr( $checkbox_id ); ?>"
<?php if ( isset( $checked_map[ $list_id ] ) ) : ?>
checked
<?php endif; ?>
/>
<strong>
<?php
if ( 1 === count( $lists ) ) {
echo \wp_kses_post( $config['single_label'] );
} else {
echo \esc_html( $list['title'] );
}
?>
</strong>
<?php if ( $config['show_description'] ) : ?>
<span class="newspack-ui__helper-text"><?php echo \esc_html( $list['description'] ); ?></span>
<?php endif; ?>
</label>
<?php endforeach; ?>
</ul>
</div>
<?php if ( ! $config['show_description'] ) : ?>
</div>
<?php endif; ?>
<?php
}

Expand Down
2 changes: 1 addition & 1 deletion includes/templates/reader-activation/login-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

\do_action( 'woocommerce_before_customer_login_form' );
?>
<div class="newspack-ui newspack-reader-auth__inline-wrapper">
<div class="newspack-ui">
adekbadek marked this conversation as resolved.
Show resolved Hide resolved
<?php Reader_Activation::render_auth_form( false ); ?>
<p class="newspack-ui__font--xs"><?php echo wp_kses_post( Reader_Activation::get_auth_footer() ); ?></p>
</div>
Expand Down
10 changes: 1 addition & 9 deletions src/blocks/reader-registration/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
"type": "boolean",
"default": false
},
"newsletterTitle": {
"type": "string",
"default": "Newsletters"
},
"newsletterLabel": {
"type": "string",
"default": "Subscribe to our newsletter"
Expand All @@ -57,13 +53,9 @@
"type": "object",
"default": {}
},
"haveAccountLabel": {
"type": "string",
"default": "Already have an account?"
},
"signInLabel": {
"type": "string",
"default": "Sign in"
"default": "Sign in to an existing account"
},
"signedInLabel": {
"type": "string",
Expand Down
Loading