Add see more button

This commit is contained in:
Ilyas Foo 2022-03-31 13:57:38 +08:00
parent fb89df5f2c
commit a3bd1e5109
3 changed files with 38 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Card, CardHeader } from '@wordpress/components'; import { Card, CardHeader, CardFooter } from '@wordpress/components';
/** /**
* Internal dependencies * Internal dependencies
@ -15,6 +15,7 @@ export const List = ( {
markConfigured, markConfigured,
recommendation, recommendation,
paymentGateways, paymentGateways,
footerLink,
} ) => { } ) => {
return ( return (
<Card> <Card>
@ -30,6 +31,11 @@ export const List = ( {
/> />
); );
} ) } } ) }
{ footerLink ? (
<CardFooter isBorderless>{ footerLink }</CardFooter>
) : (
''
) }
</Card> </Card>
); );
}; };

View File

@ -13,6 +13,8 @@ import { useMemo, useCallback, useEffect } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins'; import { registerPlugin } from '@wordpress/plugins';
import { WooOnboardingTask } from '@woocommerce/onboarding'; import { WooOnboardingTask } from '@woocommerce/onboarding';
import { getNewPath } from '@woocommerce/navigation'; import { getNewPath } from '@woocommerce/navigation';
import { Button } from '@wordpress/components';
import ExternalIcon from 'gridicons/dist/external';
/** /**
* Internal dependencies * Internal dependencies
@ -24,6 +26,9 @@ import { getPluginSlug } from '~/utils';
import './plugins/Bacs'; import './plugins/Bacs';
import './payment-gateway-suggestions.scss'; import './payment-gateway-suggestions.scss';
const SEE_MORE_LINK =
'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/?utm_source=payments_recommendations';
const comparePaymentGatewaysByPriority = ( a, b ) => const comparePaymentGatewaysByPriority = ( a, b ) =>
a.recommendation_priority - b.recommendation_priority; a.recommendation_priority - b.recommendation_priority;
@ -179,7 +184,12 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
return gateway; return gateway;
}, [ isResolving, query, paymentGateways ] ); }, [ isResolving, query, paymentGateways ] );
const [ wcPayGateway, enabledGateways, offlineGateways, additionalGateways ] = useMemo( const [
wcPayGateway,
enabledGateways,
offlineGateways,
additionalGateways,
] = useMemo(
() => () =>
Array.from( paymentGateways.values() ) Array.from( paymentGateways.values() )
.sort( ( a, b ) => { .sort( ( a, b ) => {
@ -258,7 +268,17 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
recommendation={ recommendation } recommendation={ recommendation }
paymentGateways={ additionalGateways } paymentGateways={ additionalGateways }
markConfigured={ markConfigured } markConfigured={ markConfigured }
/> footerLink={
<Button
href={ SEE_MORE_LINK }
target="_blank"
isTertiary
>
{ __( 'See more', 'woocommerce-admin' ) }
<ExternalIcon size={ 18 } />
</Button>
}
></List>
) } ) }
{ !! offlineGateways.length && ( { !! offlineGateways.length && (

View File

@ -22,6 +22,15 @@
margin: 0; margin: 0;
} }
.components-card__footer {
a.components-button {
.gridicon {
margin-left: 4px;
}
}
}
.woocommerce-task-payment__recommended-pill { .woocommerce-task-payment__recommended-pill {
border: 1px solid $studio-gray-5; border: 1px solid $studio-gray-5;
border-radius: 28px; border-radius: 28px;