Skip to content

Commit

Permalink
Update modal width to 65vw (#638)
Browse files Browse the repository at this point in the history
* update modal width to 65vw

* set the modal size to large

* update wp_enqueue_style arguments

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

---------

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Co-authored-by: Jason Crist <jcrist@pbking.com>
Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
  • Loading branch information
4 people authored May 30, 2024
1 parent 485f893 commit 2c63cdc
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
6 changes: 6 additions & 0 deletions includes/class-create-block-theme-editor-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ function create_block_theme_sidebar_enqueue() {
$asset_file['dependencies'],
$asset_file['version']
);
wp_enqueue_style(
'create-block-theme-styles',
plugins_url( 'build/plugin-sidebar.css', dirname( __FILE__ ) ),
array(),
$asset_file['version']
);
wp_enqueue_script(
'create-block-theme-slot-fill',
);
Expand Down
3 changes: 2 additions & 1 deletion src/editor-sidebar/json-editor-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ const ThemeJsonEditorModal = ( { onRequestClose } ) => {

return (
<Modal
isFullScreen
size="large"
title={ sprintf(
// translators: %s: theme name.
__( 'theme.json for %s', 'create-block-theme' ),
themeName
) }
onRequestClose={ onRequestClose }
className="create-block-theme__theme-json-modal"
>
<CodeMirror
extensions={ [ json() ] }
Expand Down
21 changes: 11 additions & 10 deletions src/editor-sidebar/metadata-editor-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,14 @@ export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {

return (
<Modal
isFullScreen
size="large"
title={ sprintf(
// translators: %s: theme name.
__( 'Metadata for %s', 'create-block-theme' ),
theme?.name
) }
onRequestClose={ onRequestClose }
className="create-block-theme__metadata-editor-modal"
>
<VStack>
<Text>
Expand Down Expand Up @@ -305,12 +306,7 @@ ${ __( 'Source', 'create-block-theme' ) }` }
<VStack alignment="left">
<img
src={ theme.screenshot }
style={ {
maxWidth: '200px',
height: 'auto',
aspectRatio: '4 / 3',
objectFit: 'cover',
} }
className="create-block-theme__metadata-editor-modal__screenshot"
alt=""
/>
<Button
Expand Down Expand Up @@ -353,9 +349,14 @@ ${ __( 'Source', 'create-block-theme' ) }` }
/>
</VStack>
<Spacer />
<Button variant="primary" onClick={ handleUpdateClick }>
{ __( 'Update', 'create-block-theme' ) }
</Button>
<HStack
justify={ 'flex-end' }
className="create-block-theme__metadata-editor-modal__footer"
>
<Button variant="primary" onClick={ handleUpdateClick }>
{ __( 'Update', 'create-block-theme' ) }
</Button>
</HStack>
</Modal>
);
};
1 change: 1 addition & 0 deletions src/plugin-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { ThemeMetadataEditorModal } from './editor-sidebar/metadata-editor-modal
import ScreenHeader from './editor-sidebar/screen-header';
import { downloadExportedTheme } from './resolvers';
import downloadFile from './utils/download-file';
import './plugin-styles.scss';

const CreateBlockThemePlugin = () => {
const [ isEditorOpen, setIsEditorOpen ] = useState( false );
Expand Down
25 changes: 25 additions & 0 deletions src/plugin-styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$plugin-prefix: "create-block-theme";
$modal-footer-height: 70px;

.#{$plugin-prefix} {
&__metadata-editor-modal {
padding-bottom: $modal-footer-height;

&__footer {
border-top: 1px solid #ddd;
background-color: #fff;
position: absolute;
bottom: 0;
margin: 0 -32px;
padding: 16px 32px;
height: $modal-footer-height;
}

&__screenshot {
max-width: 200px;
height: auto;
aspect-ratio: 4 / 3;
object-fit: cover;
}
}
}

0 comments on commit 2c63cdc

Please sign in to comment.