woocommerce/plugins/woocommerce-admin/client/task-lists/fills/appearance.js

37 lines
894 B
JavaScript
Raw Normal View History

/**
* External dependencies
*/
import React from 'react';
import { WooOnboardingTaskListItem } from '@woocommerce/onboarding';
import { registerPlugin } from '@wordpress/plugins';
import { getAdminLink } from '@woocommerce/settings';
2023-11-08 12:48:56 +00:00
export const useAppearanceClick = () => {
const onClick = () => {
window.location = getAdminLink(
'theme-install.php?browse=block-themes'
);
};
return { onClick };
};
const AppearanceFill = () => {
const { onClick } = useAppearanceClick();
return (
<WooOnboardingTaskListItem id="appearance">
{ ( { defaultTaskItem: DefaultTaskItem } ) => (
<DefaultTaskItem
// Override task click so it doesn't navigate to a task component.
onClick={ onClick }
/>
) }
</WooOnboardingTaskListItem>
);
};
registerPlugin( 'wc-admin-onboarding-task-appearance', {
scope: 'woocommerce-tasks',
render: () => <AppearanceFill />,
} );