Skip to content

Commit

Permalink
Merge branch 'trunk' into refactor/google-fonts-to-react-app
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Feb 2, 2023
2 parents 85d50fa + c124b91 commit 50cb5cf
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 33 deletions.
6 changes: 3 additions & 3 deletions admin/class-create-block-theme-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ function blockbase_save_theme() {

if ( $_POST['theme']['type'] === 'save' ) {
// Avoid running if WordPress dosn't have permission to overwrite the theme folder
if ( ! is_writable( get_stylesheet_directory() ) ) {
if ( ! wp_is_writable( get_stylesheet_directory() ) ) {
return add_action( 'admin_notices', [ $this, 'admin_notice_error_theme_file_permissions' ] );
}

Expand All @@ -909,7 +909,7 @@ function blockbase_save_theme() {
}

// Avoid running if WordPress dosn't have permission to write the theme folder
if ( ! is_writable ( get_stylesheet_directory() ) ) {
if ( ! wp_is_writable ( get_stylesheet_directory() ) ) {
return add_action( 'admin_notices', [ $this, 'admin_notice_error_theme_file_permissions' ] );
}

Expand All @@ -926,7 +926,7 @@ function blockbase_save_theme() {

else if ( $_POST['theme']['type'] === 'blank' ) {
// Avoid running if WordPress dosn't have permission to write the themes folder
if ( ! is_writable ( get_theme_root() ) ) {
if ( ! wp_is_writable ( get_theme_root() ) ) {
return add_action( 'admin_notices', [ $this, 'admin_notice_error_themes_file_permissions' ] );
}

Expand Down
4 changes: 2 additions & 2 deletions admin/class-manage-fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function can_read_and_write_font_assets_directory () {
}

// If the font asset folder can't be written return an error
if ( ! is_writable( $font_assets_path ) || ! is_readable( $font_assets_path ) || !is_writable ( $temp_dir ) ) {
if ( ! wp_is_writable( $font_assets_path ) || ! is_readable( $font_assets_path ) || ! wp_is_writable( $temp_dir ) ) {
return false;
}
return true;
Expand Down Expand Up @@ -214,7 +214,7 @@ function delete_font_asset ( $font_face ) {

$font_asset_path = $theme_folder . DIRECTORY_SEPARATOR . $font_dir . DIRECTORY_SEPARATOR . $font_path['basename'];

if ( ! is_writable( $theme_folder . DIRECTORY_SEPARATOR . $font_dir ) ) {
if ( ! wp_is_writable( $theme_folder . DIRECTORY_SEPARATOR . $font_dir ) ) {
return add_action( 'admin_notices', [ $this, 'admin_notice_font_asset_removal_error' ] );
}

Expand Down
4 changes: 3 additions & 1 deletion css/manage-fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
margin-bottom: 2rem;
}

.font-families > table > thead > td {
.font-families > table > thead td {
font-size: 1.1rem;
}

.font-family-contents .slide {
border-bottom-left-radius: 15px;
margin: 0 0 0 1.5rem;
display: block;
padding: 0;
}

.font-family-contents .container {
Expand Down
56 changes: 30 additions & 26 deletions src/manage-fonts/font-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,38 @@ function FontFamily ( { fontFamily, fontFamilyIndex, deleteFontFamily, deleteFon
return (
<table className="wp-list-table widefat table-view-list">
<thead>
<td class="font-family-head">
<div><strong>{fontFamily.name || fontFamily.fontFamily}</strong></div>
<div>
<Button
variant="tertiary"
isDestructive={true}
onClick={(e) => {
e.stopPropagation();
deleteFontFamily(fontFamilyIndex)
}}
>
{__('Remove Font Family', 'create-block-theme')}
</Button>
<Button onClick={toggleIsOpen}>
<Icon icon={isOpen ? 'arrow-up-alt2' : 'arrow-down-alt2'} />
</Button>
</div>
</td>
<tr>
<td className="font-family-head">
<div><strong>{fontFamily.name || fontFamily.fontFamily}</strong></div>
<div>
<Button
variant="tertiary"
isDestructive={true}
onClick={(e) => {
e.stopPropagation();
deleteFontFamily(fontFamilyIndex)
}}
>
{__('Remove Font Family', 'create-block-theme')}
</Button>
<Button onClick={toggleIsOpen}>
<Icon icon={isOpen ? 'arrow-up-alt2' : 'arrow-down-alt2'} />
</Button>
</div>
</td>
</tr>
</thead>
<tbody className="font-family-contents">
<div className="container">
<div className={` slide ${isOpen ? "open" : "close"}`}>
<tr className="container">
<td className={` slide ${isOpen ? "open" : "close"}`}>
<table className="wp-list-table widefat striped table-view-list">
<thead>
<td>{__('Style', 'create-block-theme')}</td>
<td>{__('Weight', 'create-block-theme')}</td>
<td class="preview-head">{__('Preview', 'create-block-theme')}</td>
{ hasFontFaces && <td></td> }
<tr>
<td>{__('Style', 'create-block-theme')}</td>
<td>{__('Weight', 'create-block-theme')}</td>
<td className="preview-head">{__('Preview', 'create-block-theme')}</td>
{ hasFontFaces && <td></td> }
</tr>
</thead>
<tbody>
{ hasFontFaces && fontFamily.fontFace.map((fontFace, i) => (
Expand All @@ -69,8 +73,8 @@ function FontFamily ( { fontFamily, fontFamilyIndex, deleteFontFamily, deleteFon
}
</tbody>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
)
Expand Down
2 changes: 1 addition & 1 deletion src/manage-fonts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function ManageFonts () {
</p>
</Modal>
) }
<p class="help">
<p className="help">
{__("These are the fonts currently embedded in your theme ", "create-block-theme")}
<Button onClick={toggleIsHelpOpen} style={{padding:"0", height:"1rem"}}>
<Icon icon={"info"}/>
Expand Down

0 comments on commit 50cb5cf

Please sign in to comment.