Skip to content

Commit a72d08b

Browse files
committed
feat: add back navigation styling to edit page
1 parent ab27ae9 commit a72d08b

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/css/edit.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,13 @@
9595
form.condition-snippet .snippet-code-container {
9696
display: none;
9797
}
98+
99+
.cs-back {
100+
cursor: pointer;
101+
102+
&::before {
103+
content: '<';
104+
color: #2271b1;
105+
margin-inline-end: 3px;
106+
}
107+
}

src/js/components/SnippetForm/SnippetForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ const EditFormWrap: React.FC = () => {
145145

146146
return (
147147
<div className="wrap">
148-
<p><small>
148+
<p><small className="cs-back">
149149
{isCondition(snippet)
150150
? <a href={addQueryArgs(window.CODE_SNIPPETS?.urls.manage, { type: 'cond' })}>
151151
{__('Back to all conditions', 'code-snippets')}

src/php/admin-menus/class-edit-menu.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ protected function ensure_correct_page() {
9797
$edit_hook .= $screen->in_admin( 'network' ) ? '-network' : '';
9898

9999
// Disallow visiting the edit snippet page without a valid ID.
100-
if ( $screen->base === $edit_hook && ( empty( $_REQUEST['id'] ) || 0 === $this->snippet->id || null === $this->snippet->id ) &&
101-
! isset( $_REQUEST['preview'] ) ) {
100+
if (
101+
$screen->base === $edit_hook
102+
&& ( empty( $_REQUEST['id'] ) || 0 === $this->snippet->id || null === $this->snippet->id )
103+
&& ! isset( $_REQUEST['preview'] )
104+
) {
102105
wp_safe_redirect( code_snippets()->get_menu_url( 'add' ) );
103106
exit;
104107
}
@@ -111,7 +114,7 @@ protected function ensure_correct_page() {
111114
*/
112115
public function render() {
113116
printf(
114-
'<div id="edit-snippet-form-container">%s</div>',
117+
'<div id="edit-snippet-form-container"><small style="position: relative; top: 14px;">%s</small></div>',
115118
esc_html__( 'Loading edit page…', 'code-snippets' )
116119
);
117120
}

0 commit comments

Comments
 (0)