Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
feat: visually hide search if less than five elements
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Mar 28, 2022
1 parent 131be7c commit cf047c3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/append-menu/AppendMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function AppendMenuComponent(props) {
</div>
<div class="cmd-change-menu__body">
<div class="cmd-change-menu__search">
<div class=${ clsx('cmd-change-menu__search', { hidden: props.entries.length < 5 }) }>
<svg class="cmd-change-menu__search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
</svg>
Expand Down
6 changes: 6 additions & 0 deletions src/change-menu/ChangeMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
overflow: hidden;
}

.cmd-change-menu__search.hidden {
position: absolute;
height: 0;
top: -1000px;
}

.cmd-change-menu__search input {
width: 100%;
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion src/element-template-chooser/ElementTemplateChooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function TemplateComponent(props) {
</div>
<div class="cmd-change-menu__body">
<div class="cmd-change-menu__search">
<div class=${ clsx('cmd-change-menu__search', { hidden: props.entries.length < 5 }) }>
<svg class="cmd-change-menu__search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
</svg>
Expand Down
2 changes: 1 addition & 1 deletion src/replace-menu/ReplaceMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function ReplaceMenuComponent(props) {
</div>
<div class="cmd-change-menu__body">
<div class="cmd-change-menu__search">
<div class=${ clsx('cmd-change-menu__search', { hidden: props.entries.length < 5 }) }>
<svg class="cmd-change-menu__search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
</svg>
Expand Down

0 comments on commit cf047c3

Please sign in to comment.