Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Manage Theme Fonts UI #226

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions admin/class-manage-fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function load_fonts_react_app () {

// Enqueue CSS of the app
wp_enqueue_style( 'fonts-app', plugins_url( 'build/index.css', __DIR__ ), array(), $asset_file['version'] );

// Load our app.js.
array_push( $asset_file['dependencies'], 'wp-i18n' );
wp_enqueue_script( 'create-block-theme-app', plugins_url( 'build/index.js', __DIR__ ), $asset_file['dependencies'], $asset_file['version'] );
Expand Down Expand Up @@ -130,9 +130,11 @@ function manage_fonts_admin_page () {

?>
<div class="wrap">
<h1 class="wp-heading-inline"><?php _e('Manage Theme Fonts', 'create-block-theme'); ?></h1>
<a href="<?php echo admin_url( 'themes.php?page=add-google-font-to-theme-json' ); ?>" class="page-title-action"><?php _e('Add Google Font', 'create-block-theme'); ?></a>
<a href="<?php echo admin_url( 'themes.php?page=add-local-font-to-theme-json' ); ?>" class="page-title-action"><?php _e('Add Local Font', 'create-block-theme'); ?></a>
<div class="manage-fonts-header-flex">
<h1 class="wp-heading-inline"><?php _e('Manage Theme Fonts', 'create-block-theme'); ?></h1>
<a href="<?php echo admin_url( 'themes.php?page=add-google-font-to-theme-json' ); ?>" class="components-button page-title-action"><?php _e('Add Google Font', 'create-block-theme'); ?></a>
<a href="<?php echo admin_url( 'themes.php?page=add-local-font-to-theme-json' ); ?>" class="components-button page-title-action"><?php _e('Add Local Font', 'create-block-theme'); ?></a>
</div>
<hr class="wp-header-end" />
<p name="theme-fonts-json" id="theme-fonts-json" class="hidden"><?php echo $fonts_json_string; ?></p>

Expand Down
6 changes: 3 additions & 3 deletions src/fonts-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ export const DEMO_DEFAULTS = {
text: DEFAULT_HEADING_TEXT,
size: 40,
lineHeight: 1.1,
margin: "0.5em",
margin: "0.5em 0",
component: "h2",
},
sentence: {
text: DEFAULT_SENTENCE_TEXT,
size: 24,
lineHeight: 1.3,
margin: "0.5em",
margin: "0.5em 0",
component: "p",
},
paragraph: {
text: DEFAULT_PARAGRAPH_TEXT,
size: 16,
lineHeight: 1.5,
margin: "0.5em",
margin: "0.5em 0",
component: "p",
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/manage-fonts/font-face.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function FontFace ( {
{/* <input style={ demoStyles } onChange={ handleChange } value={ demoText }/> */}
<Demo style={ demoStyles } />
</td>
{ deleteFontFace && <td><Button variant="tertiary" isDestructive={true} onClick={deleteFontFace}>{__('Remove', 'create-block-theme')}</Button></td> }
{ deleteFontFace && <td><Button variant="tertiary" onClick={deleteFontFace}>{__('Remove', 'create-block-theme')}</Button></td> }
</tr>
);
}
Expand Down
1 change: 0 additions & 1 deletion src/manage-fonts/font-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function FontFamily ( { fontFamily, fontFamilyIndex, deleteFontFamily, deleteFon
<div>
<Button
variant="tertiary"
isDestructive={true}
onClick={(e) => {
e.stopPropagation();
deleteFontFamily(fontFamilyIndex)
Expand Down
35 changes: 34 additions & 1 deletion src/manage-fonts/manage-fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,46 @@
vertical-align: middle;
}

.font-family-head {
.widefat td {
padding: .5rem 2rem;
}

td.font-family-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
background-color: #f6f7f7;
}

.font-family-head div:last-of-type {
display: flex;
gap: 1rem;
}

.slide.open {
margin: 0;
border: none;
}

table.widefat.wp-list-table {
border-radius: 2px;
}

table.widefat table {
border: none;
}

.manage-fonts-header-flex {
display: flex;
align-items: flex-end;
}

.manage-fonts-header-flex .wp-heading-inline+.page-title-action {
margin-left: auto;
}

.components-button.page-title-action {
font-weight: normal;
margin-left: .75rem;
}