Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Oct 12, 2023
1 parent f3c2b9e commit 9609356
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ import {
} from '../../utils/template-part-create';

export default function CreateTemplatePartModal( {
area: areaProp = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
area: defaultArea = TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
blocks = [],
buttonLabel = __( 'Create' ),
confirmLabel = __( 'Create' ),
closeModal,
modalTitle = __( 'Create template part' ),
onCreate,
onError,
title: titleProp = '',
title: defaultTitle = '',
} ) {
const { createErrorNotice } = useDispatch( noticesStore );
const { saveEntityRecord } = useDispatch( coreStore );
const existingTemplateParts = useExistingTemplateParts();

const [ title, setTitle ] = useState( titleProp );
const [ area, setArea ] = useState( areaProp );
const [ title, setTitle ] = useState( defaultTitle );
const [ area, setArea ] = useState( defaultArea );
const [ isSubmitting, setIsSubmitting ] = useState( false );
const instanceId = useInstanceId( CreateTemplatePartModal );

Expand Down Expand Up @@ -185,7 +185,7 @@ export default function CreateTemplatePartModal( {
aria-disabled={ ! title || isSubmitting }
isBusy={ isSubmitting }
>
{ buttonLabel }
{ confirmLabel }
</Button>
</HStack>
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function DuplicateMenuItem( {
</MenuItem>
{ isModalOpen && ! isTemplatePart && (
<CreatePatternModal
buttonLabel={ __( 'Duplicate' ) }
confirmLabel={ __( 'Duplicate' ) }
modalTitle={ __( 'Duplicate pattern' ) }
onClose={ closeModal }
onError={ closeModal }
Expand All @@ -129,7 +129,7 @@ export default function DuplicateMenuItem( {
) }
{ isModalOpen && isTemplatePart && (
<CreateTemplatePartModal
buttonLabel={ __( 'Duplicate' ) }
confirmLabel={ __( 'Duplicate' ) }
closeModal={ closeModal }
modalTitle={ __( 'Duplicate template part' ) }
onCreate={ onTemplatePartSuccess }
Expand Down
16 changes: 8 additions & 8 deletions packages/patterns/src/components/create-pattern-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import CategorySelector, { CATEGORY_SLUG } from './category-selector';
import { unlock } from '../lock-unlock';

export default function CreatePatternModal( {
buttonLabel = __( 'Create' ),
categories: categoriesProp = [],
confirmLabel = __( 'Create' ),
categories: defaultCategories = [],
className = 'patterns-menu-items__convert-modal',
content,
modalTitle = __( 'Create pattern' ),
onClose,
onError,
onSuccess,
syncType: syncTypeProp = PATTERN_SYNC_TYPES.full,
title: titleProp = '',
syncType: defaultSyncType = PATTERN_SYNC_TYPES.full,
title: defaultTitle = '',
} ) {
const [ syncType, setSyncType ] = useState( syncTypeProp );
const [ categoryTerms, setCategoryTerms ] = useState( categoriesProp );
const [ title, setTitle ] = useState( titleProp );
const [ syncType, setSyncType ] = useState( defaultSyncType );
const [ categoryTerms, setCategoryTerms ] = useState( defaultCategories );
const [ title, setTitle ] = useState( defaultTitle );

const [ isSaving, setIsSaving ] = useState( false );
const { createPattern } = unlock( useDispatch( patternsStore ) );
Expand Down Expand Up @@ -209,7 +209,7 @@ export default function CreatePatternModal( {
aria-disabled={ ! title || isSaving }
isBusy={ isSaving }
>
{ buttonLabel }
{ confirmLabel }
</Button>
</HStack>
</VStack>
Expand Down

0 comments on commit 9609356

Please sign in to comment.