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

37 lines
887 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';
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 />,
} );