react-code-dataset / wp-calypso /client /sites /deployments /components /deployment-style /workflow-validation.tsx
react-code-dataset / wp-calypso /client /sites /deployments /components /deployment-style /workflow-validation.tsx
Download wp-calypso/client/sites/deployments/components/deployment-style/workflow-validation.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 977 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/deployments/components/deployment-style/workflow-validation.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/sites/deployments/components/deployment-style/workflow-validation.tsx
-
curl -L -o workflow-validation.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/deployments/components/deployment-style/workflow-validation.tsx
977 Bytes
| import { FoldableCard, Spinner } from '@automattic/components'; | |
| import { Icon } from '@wordpress/components'; | |
| import { check, closeSmall } from '@wordpress/icons'; | |
| import clsx from 'clsx'; | |
| import { ReactNode } from 'react'; | |
| import { WorkFlowStates } from './use-check-workflow-query'; | |
| export const WorkflowValidation = ( { | |
| status, | |
| label, | |
| children, | |
| }: { | |
| status: WorkFlowStates; | |
| label: string; | |
| children: ReactNode; | |
| } ) => { | |
| const getValidationIcon = () => { | |
| if ( status === 'loading' ) { | |
| return <Spinner className="custom-icons" />; | |
| } | |
| return ( | |
| <Icon | |
| size={ 20 } | |
| icon={ status === 'success' ? check : closeSmall } | |
| className={ clsx( 'custom-icons', status ) } | |
| /> | |
| ); | |
| }; | |
| return ( | |
| <div> | |
| <FoldableCard | |
| className={ status === 'error' ? 'is-error' : '' } | |
| clickableHeader | |
| expanded={ false } | |
| header={ | |
| <> | |
| { getValidationIcon() } | |
| { label } | |
| </> | |
| } | |
| > | |
| { children } | |
| </FoldableCard> | |
| </div> | |
| ); | |
| }; | |