Skip to content

Commit

Permalink
Try moving the create and export options to the menu flow instead of …
Browse files Browse the repository at this point in the history
…the create panel
  • Loading branch information
pbking committed Apr 10, 2024
1 parent 14a6f16 commit 02f11ab
Show file tree
Hide file tree
Showing 2 changed files with 320 additions and 112 deletions.
203 changes: 107 additions & 96 deletions src/editor-sidebar/create-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@wordpress/components';
import { chevronLeft, addCard, download, copy } from '@wordpress/icons';

export const CreateThemePanel = () => {
export const CreateThemePanel = ( { createType } ) => {
const { createErrorNotice } = useDispatch( noticesStore );

const [ theme, setTheme ] = useState( {
Expand Down Expand Up @@ -306,107 +306,118 @@ export const CreateThemePanel = () => {
setTheme( { ...theme, subfolder: value } )
}
/>
</VStack>
<Spacer />
<hr></hr>
<Spacer />
<Button
icon={ copy }
variant="secondary"
onClick={ handleCloneClick }
>
{ __( 'Clone Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a copy of this theme on the server and activate it. The user changes will be preserved in the new theme.',
'create-block-theme'
{ createType === 'createClone' && (
<>
<Button
icon={ copy }
variant="primary"
onClick={ handleCloneClick }
>
{ __( 'Clone Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a copy of this theme on the server and activate it. The user changes will be preserved in the new theme.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>
<hr></hr>
<Spacer />
<Button
icon={ copy }
variant="secondary"
onClick={ handleCreateChildClick }
>
{ __( 'Create Child Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a child theme on the server and activate it. The user changes will be preserved in the new theme.',
'create-block-theme'
{ createType === 'createChild' && (
<>
<Button
icon={ copy }
variant="primary"
onClick={ handleCreateChildClick }
>
{ __( 'Create Child Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a child theme on the server and activate it. The user changes will be preserved in the new theme.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>

<hr></hr>
<Spacer />
<Button
icon={ copy }
variant="secondary"
onClick={ handleCreateVariationClick }
>
{ __( 'Create Theme Variation', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Save the Global Styles changes as a theme variation.',
'create-block-theme'
{ createType === 'createVariation' && (
<>
<Button
icon={ copy }
variant="primary"
onClick={ handleCreateVariationClick }
>
{ __(
'Create Theme Variation',
'create-block-theme'
) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Save the Global Styles changes as a theme variation.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>

<hr></hr>
<Spacer />
<Button
icon={ download }
variant="secondary"
onClick={ handleExportClick }
>
{ __( 'Export Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Export a copy of this theme as a .zip file. The user changes will be preserved in the new theme.',
'create-block-theme'
{ createType === 'exportClone' && (
<>
<Button
icon={ download }
variant="primary"
onClick={ handleExportClick }
>
{ __( 'Export Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Export a copy of this theme as a .zip file. The user changes will be preserved in the new theme.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>
<hr></hr>
<Spacer />
<Button
icon={ download }
variant="secondary"
onClick={ handleExportChildClick }
>
{ __( 'Export Child Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Export a child of this theme as a .zip file. The user changes will be preserved in the new theme.',
'create-block-theme'
{ createType === 'exportChild' && (
<>
<Button
icon={ download }
variant="primary"
onClick={ handleExportChildClick }
>
{ __( 'Export Child Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Export a child of this theme as a .zip file. The user changes will be preserved in the new theme.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>
<hr></hr>
<Spacer />
<Button
icon={ addCard }
variant="secondary"
onClick={ handleCreateBlankClick }
>
{ __( 'Create Blank Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a blank theme with no styles or templates.',
'create-block-theme'
{ createType === 'createBlank' && (
<>
<Button
icon={ addCard }
variant="primary"
onClick={ handleCreateBlankClick }
>
{ __( 'Create Blank Theme', 'create-block-theme' ) }
</Button>
<Spacer />
<Text variant="muted">
{ __(
'Create a blank theme with no styles or templates.',
'create-block-theme'
) }
</Text>
</>
) }
</Text>
<Spacer />
</VStack>
</PanelBody>
);
};
Loading

0 comments on commit 02f11ab

Please sign in to comment.