-
Notifications
You must be signed in to change notification settings - Fork 815
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
Simple payments styling #7500
Simple payments styling #7500
Conversation
<div class='jetpack-simple-payments-price'>{$data['price']}</div> | ||
{$items} | ||
<div class='jetpack-simple-payments-button' id='{$data['dom_id']}_button'></div> | ||
<div class='jetpack-simple-payments-payment-row'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should name the classes as jetapck-simple-payments__payment-row
. At least that's what we do in Calypso and it's quite nice. Can we rework it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid using underscores for front-end staff. https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#selectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge #7495 before this PR since I've refactored class names. |
@@ -94,9 +95,11 @@ function output_shortcode( $data ) { | |||
<div class='{$data[ 'class' ]} jetpack-simple-payments-wrapper'> | |||
<div class='jetpack-simple-payments-title'>{$data['title']}</div> | |||
<div class='jetpack-simple-payments-description'>{$data['description']}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have <p>
inside of div.jetpack-simple-payments-description
? Themes most likely has spacing for it and that would avoid having an arbitrary margin for this specific shortcode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
59ea83a9dfe3373ad56fb7d3cc457768f949b3dc
@@ -94,9 +95,11 @@ function output_shortcode( $data ) { | |||
<div class='{$data[ 'class' ]} jetpack-simple-payments-wrapper'> | |||
<div class='jetpack-simple-payments-title'>{$data['title']}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have <strong>
inside of div.jetpack-simple-payments-title
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, that^ was a bad idea. Sorry, let make it bold with CSS as it was.
{$items} | ||
<div class='jetpack-simple-payments-button' id='{$data['dom_id']}_button'></div> | ||
<div class='jetpack-simple-payments-payment-row'> | ||
<div class='jetpack-simple-payments-price'>{$data['price']}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have also <p>
inside of div.jetpack-simple-payments-price
for the same reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, also <strong>
please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore the <strong>
suggestion, sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
59ea83a9dfe3373ad56fb7d3cc457768f949b3dc
d0b7836
to
52a510b
Compare
I'll change the class names according to this comment: #7500 (comment) Also, we had to rebase it since there were conflicts. |
d4a24dd
to
5f77a72
Compare
@@ -16,6 +16,7 @@ | |||
.jetpack-simple-payments-price { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you have some suggestion here @iamtakashi, using flexbox for instance. Feel free to edit this file.
body .jetpack-simple-payments__wrapper div.jetpack-simple-payments__purchase-message, | ||
body .jetpack-simple-payments__wrapper div.jetpack-simple-payments__purchase-message a { | ||
/* stronger rule in order to set the text color */ | ||
body .jetpack-simple-payments-wrapper div.jetpack-simple-payments-purchase-message { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per #7495, let's change it to <p>
instead of <div>
.
style: { | ||
label: 'pay', | ||
color: 'blue' | ||
shape: 'pill', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realised there is rect
option for shape
. I think I prefer the rectangle than the pill that feels a bit old school to me. Let's go with rect
.
3f0ef54
to
8c87368
Compare
return " | ||
<div class='{$data['class']} ${cssPrefix}-wrapper'> | ||
<p class='${cssPrefix}-purchase-message'></p> | ||
<div class='${cssPrefix}-title'>{$data['title']}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safer to have <p>
inside of the <div>
as well. This will likely add bottom margin to the title, but we actually need it. If the product doesn't have description there wouldn't be spacing between the title and the price.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class='${cssPrefix}-title'><p>{$data['title']}</p></div>
<div class='{$data['class']} ${cssPrefix}-wrapper'> | ||
<p class='${cssPrefix}-purchase-message'></p> | ||
<div class='${cssPrefix}-title'>{$data['title']}</div> | ||
<p class='${cssPrefix}-description'>{$data['description']}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good that we now have <p>
around the price but can we keep the outer div
we had?
<div class='${cssPrefix}-description'><p>{$data['price']}</p></div>
<div class='${cssPrefix}-title'>{$data['title']}</div> | ||
<p class='${cssPrefix}-description'>{$data['description']}</p> | ||
<div class='${cssPrefix}-purchase-box'> | ||
<p class='${cssPrefix}-price'>{$data['price']}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class='${cssPrefix}-price'><p>{$data['price']}</p></div>
Please work on the image part ASAP. The style and markup can be tweaked after. |
@@ -12,6 +12,8 @@ class Jetpack_Simple_Payments { | |||
|
|||
static $shortcode = 'simple-payment'; | |||
|
|||
static $cssClassnamePrefix = 'jetpack-simple-payments'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP is snake_case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-o thanks
"; | ||
return $output; | ||
|
||
return " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make tabs in site html code as well, it was tabbed to the left so we dont print out unnecessary tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ic, I thought it was a mistake. Reverting now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Feel free to merge before of after that #7503.
764f3b0
to
2ae1da0
Compare
6ea277d
to
67a6324
Compare
<div class='jetpack-simple-payments__button' id='{$data['dom_id']}_button'></div> | ||
|
||
return " | ||
<div class='{$data['class']} ${cssPrefix}-wrapper'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding the class name prefix as a variable is not very helpful. It's harder to read the styling then and I've never seen class naming in a variable. :) We are also not going to change the class name prefix I think -- why would we?
margin-top: 0.3em; | ||
} | ||
|
||
.jetpack-simple-payments-price { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use flexbox (like we do in Calypso Editor previews) or at least clear the floats in the parent div
.
The QTY field still doesn't appear in my testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think that is what we want: |
* Introduce Jetpack_Simple_Payments class, load it * Add doc about format to CPT * Add more docs * Add enabled / disabled status * Add shortcode * reg shortcode * Add shortcode logic * Fix func * fix class * rename to product * Better content passing * Pass proper JS * Add comments * Rename to "paypal-express-checkout" * Add price * Label change * jshint fixes * filter * items * Throw error if paypal not defined * Info about script hosted with PP * Get rid of static keyword * Fix some lint issues * proper header * Adjust classes to WP coding standards * Change header * Change comment * add payload for number of items * Make ids work for paypal code * repair init code * Introduce ID for form * Add endpoint urls * Better domain * Endpoint urls with blog_id * Fix id * Add version * Change endpoint * Make sandbox * Add post meta syncing * Sandbox management * Review fixes * remove console Attempt to make test pass in JS * Fir for missing product * simple-payments: print message when the transaction ends. * simple-payments: clean message placeholder * simple-payments: implement styles to the block * some change * simple-payments: improve showing transaction messages * Put the purchase message into HTML, hidden by default * Toggle purchase messages with either success/error and message * Use p tag instead of div with margin Props @iamtakashi for the suggestion. * Remove unneeded code * Fix typo * Fix paypal checkout.js script error * Use .html instead of text to append html content * Removing one error message: there's no error to show, uneeded * Fix toggle logic of the purchase message * fix linting issue * update success copy * simple-payments: small coding improvements in output_shortcode() * simple-payments: do not use underscore in css class https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#selectors * simple-payments: minor improvements defining endpoints * simple-payments: use `<p>` tag for description and price #7500 (comment) * simple-payments: minor improvements * simple-payments: add purchase-box container. improve paypal button styles. * Simple Payments: update error message handling (#7503) - display success message from backend ( D6514-code ) - display all error messages * simple-pyaments: wrap all text into `<p>` elems * simple-payments: move globals as PaypalExpressCheckout properties * simple-payments: coding improvementes. * simple-payments: minor code improvements * rebase: squash -> "simple-payments: move globals as PaypalExpressCheckout properties" * Remove wpautop for Simple Payments product content/description (#7507) * Simple payments: image (#7508) Introduces an image to a payment button * Disable default sandboxing * simple-payments: user camel-case convention * reenable sandbox * Add env handling * Simple Payments: Style shortcode * simple-payments: inject msgs in the right place * simple-payments: show error in onAuthorize callback * fix additional error messages * Simple Payments: Modify message style * fix empty join call * Simple Payments: Reset iframe margin * wrap default error message * Implement review feedback * Add min field * SimplePayments: add formatted price meta data (#7521) Output `spay_formatted_price` if present * somple-payments: improve-error-handling * simple-payments: check processErrorMessage() param * Fixed lint errors. * Simple Payments: return wpcom blog_id if code is running on wpcom (#7524) * Simple Payments: add method to process success messages (#7528) Fixes styling of success messages.
Please continue