Skip to content

Commit

Permalink
change: results wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
troychaplin committed Aug 4, 2024
1 parent 6335a08 commit 5530ba0
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build/block-finder-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/block-finder.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '677f28795b4f66f7d30f');
<?php return array('dependencies' => array(), 'version' => '8ba02d3ad6c07bef19ba');
2 changes: 1 addition & 1 deletion build/block-finder.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/block-finder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public function findBlockForm()
});

echo '<form id="block-finder-form">';
echo '<label for="post-type-selector">Select a post type:</label>';
echo '<label for="post-type-selector">Select a post type you wish to search in</label>';
echo '<select id="post-type-selector" name="post_type">';
echo '<option value="">Select a post type</option>'; // Default option
echo '<option value="">-- Select post type --</option>';
foreach ($gutenberg_post_types as $post_type) {
echo '<option value="' . esc_attr($post_type->name) . '">' . esc_html($post_type->label) . '</option>';
}
echo '</select>';

echo '<label for="block-finder-selector">Select a block to return a list of where it is being used on your site.</label>';
echo '<label for="block-finder-selector">Select a block you would like to search for</label>';
echo '<select id="block-finder-selector" name="block">';
echo '<option value="">Select a block to find</option>'; // Default option
echo '<option value="">-- Select block --</option>';
foreach ($inserter_blocks as $block_name => $block_type) {
if (!empty($block_type->title)) {
echo '<option value="' . esc_attr($block_name) . '">' . esc_html($block_type->title) . '</option>';
Expand Down
3 changes: 2 additions & 1 deletion src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ document.addEventListener('DOMContentLoaded', () => {
// Show loading indicator
submitButton.disabled = true;
submitButton.textContent = 'Finding blocks...';
resultsContainer.innerHTML = '<p>Loading results...</p>';
resultsContainer.innerHTML =
'<p id="block-results-loading">Loading results...</p>';

if (postType === '' || block === '') {
resultsContainer.innerHTML =
Expand Down
69 changes: 37 additions & 32 deletions src/styles.css
Original file line number Diff line number Diff line change
@@ -1,63 +1,68 @@
#block-finder-form label {
padding-bottom: 16px;
padding-bottom: 16px;
}

#block-finder-selector, #post-type-selector {
display: block;
margin-bottom: 10px;
padding: 5px;
width: 100%;
max-width: 400px;
#block-finder-selector,
#post-type-selector {
display: block;
margin-bottom: 10px;
padding: 2px 8px;
width: 100%;
max-width: 400px;
}

#block-results-loading {
padding: 14px 12px;
}

#block-finder-results {
background-color: #f2f2f2;
margin-top: 15px;
background-color: #f2f2f2;
margin-top: 15px;
}

#block-finder-results h3 {
font-weight: 700;
border-bottom: 1px solid #b9b9b9;
padding: 14px 12px;
margin: 0;
font-weight: 700;
border-bottom: 1px solid #b9b9b9;
padding: 14px 12px;
margin: 0;
}

#block-finder-results ul {
list-style-type: none;
padding: 0;
margin: 0;
list-style-type: none;
padding: 0;
margin: 0;
}

#block-finder-results li {
display: flex;
gap: 8px;
padding: 14px 12px;
margin-bottom: 0;
border-bottom: 1px dotted #b9b9b9;
display: flex;
gap: 8px;
padding: 14px 12px;
margin-bottom: 0;
border-bottom: 1px dotted #b9b9b9;
}

#block-finder-results li:last-child {
border-bottom: none;
border-bottom: none;
}

#block-finder-results span {
margin-left: auto;
display: flex;
gap: 8px;
align-items: center;
margin-left: auto;
display: flex;
gap: 8px;
align-items: center;
}

#block-finder-results a {
font-weight: 500;
color: #0073aa;
text-decoration: none;
font-weight: 500;
color: #0073aa;
text-decoration: none;
}

#block-finder-results a:last-child {
border-left: 1px solid #b9b9b9;
padding-left: 8px;
border-left: 1px solid #b9b9b9;
padding-left: 8px;
}

#block-finder-results a:hover {
text-decoration: underline;
text-decoration: underline;
}

0 comments on commit 5530ba0

Please sign in to comment.