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

Replace invalid and missing URLs (4136) #3044

Merged
merged 23 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f64a948
✨ Prepare new LearnMore component
stracker-phil Jan 28, 2025
d273ad1
💬 Remove trailing space from URLs
stracker-phil Jan 28, 2025
8aee26c
🔀 Merge branch 'trunk'
stracker-phil Jan 29, 2025
badef20
🔥 Remove unused prop from BadgeBox
stracker-phil Jan 29, 2025
990b945
✨ Finish the LearnMore component
stracker-phil Jan 29, 2025
77bf406
✨ Add the LearnMore link into BadgeBox
stracker-phil Jan 29, 2025
e00a6e1
♻️ Improve readability of SCSS code
stracker-phil Jan 29, 2025
c79ed52
🔀 Merge branch 'trunk'
stracker-phil Jan 29, 2025
77badd3
♻️ Move all learn-more links into the new prop
stracker-phil Jan 29, 2025
dda23b3
💄 Style the new LearnMore links
stracker-phil Jan 29, 2025
8edbb87
♻️ Extract repeat code into components
stracker-phil Jan 29, 2025
b9fc9cd
🔀 Merge branch 'trunk'
stracker-phil Feb 3, 2025
7c41863
🎨 Add whitespace only
stracker-phil Feb 3, 2025
90cce3b
✨ New payment method components
stracker-phil Feb 3, 2025
17f5b9d
♻️ Extract code into separate components
stracker-phil Feb 3, 2025
a2ce42b
♻️ Extract repeat code into separate components
stracker-phil Feb 3, 2025
a63cf67
♻️ New customizable PaymentFlow component
stracker-phil Feb 3, 2025
9c5b7a1
✨ Add prop for each method’s learn more link
stracker-phil Feb 3, 2025
5035b9d
♻️ Shorten internal payment method name
stracker-phil Feb 3, 2025
e7820c4
✨ Add list of learn-more URLs
stracker-phil Feb 3, 2025
0cb6bc4
✨ Display dynamic learn-more links
stracker-phil Feb 3, 2025
9c7535e
♻️ Use new PaymentFlow in StepPaymentMethods
stracker-phil Feb 3, 2025
0894d9e
🔀 Merge branch 'trunk'
stracker-phil Feb 4, 2025
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
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
.ppcp-r-badge-box {
margin: 0 0 8px 0;

&__title {
.ppcp-r-badge-box__title {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, maybe I am missing something, but why is this changed ?

@include font(14, 20, 700);
display: block;
margin: 0 0 8px 0;

.ppcp-r-badge-box__title-text {
@include font(16, 28, 700);
color: #000;

&--big {
@include font(16, 28, 700);
}

&--small {
vertical-align: text-bottom;
}
}

.ppcp-r-badge-box__title-text:not(:empty) + .ppcp-r-badge-box__title-image-badge {
Expand All @@ -27,25 +20,32 @@
height: 24px;
}
}
}

&--has-image-badge .ppcp-r-title-badge--info {
display: block;
margin: 6px 0 0 0;
width: fit-content;
}
.ppcp-r-badge-box__title--has-image-badge .ppcp-r-title-badge--info {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

display: block;
margin: 6px 0 0 0;
width: fit-content;
}

.components-button.is-tertiary {
padding: 0;
margin: 0 0 0 4px;
height: 1em;
}

@media screen and (max-width: 480px) {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
flex-direction: column;

@media screen and (max-width: 480px) {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
flex-direction: column;
.ppcp-r-badge-box__title-text:not(:empty) + .ppcp-r-badge-box__title-image-badge {
margin: 0;

.ppcp-r-badge-box__title-text:not(:empty) + .ppcp-r-badge-box__title-image-badge {
img:first-of-type {
margin: 0;
img:first-of-type {
margin: 0;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,31 @@
}
}

.ppcp-r-optional-payment-methods {
&__wrapper {
.ppcp-r-badge-box {
margin: 0 0 24px 0;
&:last-child {
margin: 0;
}
}
.ppcp-r-optional-payment-methods__wrapper {
.ppcp-r-badge-box {
margin: 0 0 24px 0;

.ppcp-r-badge-box__description {
margin: 12px 0 0 0;
@include font(14, 20, 400);
&:last-child {
margin: 0;
}
}

&__description {
margin: 32px 0 0 0;
text-align: center;
@include font(14, 22, 400);
font-style: italic;

a {
color: $color-gray-700;
}
.ppcp-r-badge-box__description {
margin: 12px 0 0 0;
}
}

&__separator {
margin: 0 0 24px 0;
.ppcp-r-optional-payment-methods__description {
@include font(14, 22, 400);
margin: 32px 0 0 0;
text-align: center;
font-style: italic;

a {
color: $color-gray-700;
}
}

.ppcp-r-optional-payment-methods__separator {
margin: 0 0 24px 0;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LearnMore } from './Elements';
import { PPIcon } from './Icons';

const ImageBadge = ( { images } ) => {
Expand All @@ -20,30 +21,37 @@ const ImageBadge = ( { images } ) => {
);
};

// If `children` is not empty, it's output and wrapped in spaces.
// If `children` is not empty, the `children` prop is output and wrapped in spaces.
const BadgeContent = ( { children } ) => {
if ( ! children ) {
return null;
}
return <> { children } </>;
};

const BadgeDescription = ( { description, learnMoreLink } ) => {
if ( ! description && ! learnMoreLink ) {
return null;
}

return (
<div className="ppcp-r-badge-box__description">
<p className="ppcp-r-badge-box__description">
{ description }
<LearnMore url={ learnMoreLink } />
</p>
</div>
);
};

const BadgeBox = ( {
title,
textBadge,
imageBadge = [],
titleType = BADGE_BOX_TITLE_BIG,
description = '',
learnMoreLink = '',
} ) => {
let titleSize = BADGE_BOX_TITLE_SMALL;
if ( BADGE_BOX_TITLE_BIG === titleType ) {
titleSize = BADGE_BOX_TITLE_BIG;
}

const titleTextClassName =
'ppcp-r-badge-box__title-text ' +
`ppcp-r-badge-box__title-text--${ titleSize }`;

const titleTextClassName = 'ppcp-r-badge-box__title-text';
const titleBaseClassName = 'ppcp-r-badge-box__title';
const titleClassName = imageBadge.length
? `${ titleBaseClassName } ppcp-r-badge-box__title--has-image-badge`
Expand All @@ -57,20 +65,13 @@ const BadgeBox = ( {
<ImageBadge images={ imageBadge } />
<BadgeContent>{ textBadge }</BadgeContent>
</span>
<div className="ppcp-r-badge-box__description">
{ description && (
<p
className="ppcp-r-badge-box__description"
dangerouslySetInnerHTML={ {
__html: description,
} }
></p>
) }
</div>

<BadgeDescription
description={ description }
learnMoreLink={ learnMoreLink }
/>
</div>
);
};

export const BADGE_BOX_TITLE_BIG = 'big';
export const BADGE_BOX_TITLE_SMALL = 'small';
export default BadgeBox;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';

const LearnMore = ( { url } ) => {
if ( ! url || '#' === url ) {
return null;
}

return (
<Button href={ url } variant="tertiary" target="_blank">
{ __( 'Learn more', 'woocommerce-paypal-payments' ) }
</Button>
);
};

export default LearnMore;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export { default as Content } from './Content';
export { default as ContentWrapper } from './ContentWrapper';
export { default as Description } from './Description';
export { default as Header } from './Header';
export { default as LearnMore } from './LearnMore';
export { default as Separator } from './Separator';
export { default as Title } from './Title';
export { default as TitleExtra } from './TitleExtra';
export { default as TitleWrapper } from './TitleWrapper';
export { default as Separator } from './Separator';
Loading
Loading