1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-05-06 14:41:02 -05:00

Merge pull request 'Refactor home search' (#21) from moiety/search into develop

Reviewed-on: https://koodu.h-i.works/projects/thebadspace/pulls/21
Reviewed-by: RXP <ro@noreply.koodu.h-i.works>
This commit is contained in:
RXP 2025-05-05 22:44:21 +02:00
commit d310cf4fb9
4 changed files with 72 additions and 40 deletions

View File

@ -3,6 +3,12 @@ section.index-search {
background: var(--white); background: var(--white);
} }
/* TODO: move to a global file? its not only for forms. */
section.index-search :focus-visible {
outline: 2px solid var(--white);
outline-offset: -4px;
}
section.start a.search-link { section.start a.search-link {
color: var(--highlight); color: var(--highlight);
font-size: 2.5em; font-size: 2.5em;
@ -12,36 +18,57 @@ section.start a.search-link {
} }
form.index-search-form { form.index-search-form {
display: grid;
grid-template-columns: auto max-content;
gap: 15px;
width: 80%; width: 80%;
max-width: 1000px; max-width: 1000px;
margin: 0 auto; margin: 0 auto;
padding: 30px 0; padding: 30px 0;
} }
form.index-search-form > input,
form.index-search-form > button {
display: block;
margin: 0;
width: 100%;
height: 60px;
box-sizing: border-box;
}
form.index-search-form > input:focus {
color: var(--white);
}
form.index-search-form > input[type="text"] { form.index-search-form > input[type="text"] {
width: 88%;
height: 50px;
font: 44px var(--base-type); font: 44px var(--base-type);
} }
form.index-search-form > input[type="hidden"] {
/* This removes it from the grid calculations */
position: absolute;
}
form.index-search-form > button { form.index-search-form > button {
height: 60px; display: grid;
grid-template-columns: auto;
align-items: center;
padding: 0;
width: 60px; width: 60px;
position: relative; text-transform: uppercase;
top: 9px;
right: 0;
} }
form.index-search-form > button > img#search-icon { form.index-search-form > button > svg {
float: none; justify-self: center;
width: 48px;
height: 48px;
} }
form.index-search-form > button > label { form.index-search-form > button > span {
font-weight: 500;
top: 15px;
position: relative;
font-size: 1.5em;
display: none; display: none;
margin-top: 3px;
font-weight: 500;
font-size: 1.5em;
} }
::placeholder { ::placeholder {
@ -81,37 +108,34 @@ table.index-meta td {
@media only screen and (max-width: 800px) { @media only screen and (max-width: 800px) {
form.index-search-form > input[type="text"] { form.index-search-form > input[type="text"] {
width: 85%;
height: 50px;
font: 34px var(--base-type); font: 34px var(--base-type);
} }
} }
@media only screen and (max-width: 650px) { @media only screen and (max-width: 650px) {
form.index-search-form > input[type="text"] { form.index-search-form > input[type="text"] {
width: 80%;
height: 50px;
font: 34px var(--base-type); font: 34px var(--base-type);
} }
} }
@media only screen and (max-width: 480px) { @media only screen and (max-width: 480px) {
form.index-search-form {
grid-template-columns: auto;
}
form.index-search-form > input[type="text"] { form.index-search-form > input[type="text"] {
width: 99%;
height: 50px;
font: 27px var(--base-type); font: 27px var(--base-type);
} }
form.index-search-form > input[type="text"],
form.index-search-form > button { form.index-search-form > button {
width: 99%; width: 100%;
top: 15px;
} }
form.index-search-form > button > label { form.index-search-form > button {
display: inline; grid-template-columns: auto 60px;
} }
form.index-search-form > button > img#search-icon { form.index-search-form > button span {
float: right; display: block;
} }
} }

View File

@ -8,16 +8,25 @@ input[type="text"] {
display: inline-block; display: inline-block;
background: var(--white); background: var(--white);
color: var(--primary); color: var(--primary);
transition: all 0.2s linear; transition: 0.2s linear;
transition-property: color, background-color;
height: 30px; height: 30px;
} }
input[type="text"]:focus, input[type="text"]:focus,
input[type="password"]:focus { input[type="password"]:focus {
outline: solid var(--highlight);
background-color: var(--highlight); background-color: var(--highlight);
} }
/* TODO: generalise this a bit */
button:focus,
input[type="submit"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
outline: 2px solid var(--white);
outline-offset: -4px;
}
textarea { textarea {
border: 0; border: 0;
border-radius: 3px; border-radius: 3px;
@ -34,7 +43,8 @@ input[type="submit"] {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
border: 0; border: 0;
transition: all 0.3s linear; transition: 0.3s linear;
transition-property: color, background-color;
height: 35px; height: 35px;
margin-top: 15px; margin-top: 15px;
} }

View File

@ -1,8 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" id="search">
<!-- Generated by Pixelmator Pro 3.3.8 --> <path fill="none" stroke="currentcolor" stroke-width="8.777778" stroke-linecap="round" stroke-linejoin="round" d="M 11 41.722221 C 11 58.68964 24.754808 72.444443 41.722221 72.444443 C 58.68964 72.444443 72.444443 58.68964 72.444443 41.722221 C 72.444443 24.754807 58.68964 11 41.722221 11 C 24.754808 11 11 24.754807 11 41.722221"/>
<svg width="101" height="100" viewBox="0 0 101 100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="currentcolor" stroke-width="8.777778" stroke-linecap="round" stroke-linejoin="round" d="M 90 90 L 63.666668 63.666668"/>
<g id="Group-copy">
<path id="Path-copy-2" fill="none" stroke="#efebe3" stroke-width="8.777778" stroke-linecap="round" stroke-linejoin="round" d="M 11 41.722221 C 11 58.68964 24.754808 72.444443 41.722221 72.444443 C 58.68964 72.444443 72.444443 58.68964 72.444443 41.722221 C 72.444443 24.754807 58.68964 11 41.722221 11 C 24.754808 11 11 24.754807 11 41.722221"/>
<path id="Path-copy" fill="none" stroke="#efebe3" stroke-width="8.777778" stroke-linecap="round" stroke-linejoin="round" d="M 90 90 L 63.666668 63.666668"/>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 729 B

After

Width:  |  Height:  |  Size: 571 B

View File

@ -5,9 +5,11 @@
<section class="index-search"> <section class="index-search">
<form class="index-search-form" action="/search" method="post" enctype="multipart/form-data"> <form class="index-search-form" action="/search" method="post" enctype="multipart/form-data">
<input type="text" name="index_search" value="" placeholder="Hi! This is where you search." /> <input type="text" name="index_search" value="" placeholder="Hi! This is where you search." />
<button aria-label="search-button"> <button aria-labelledby="search-label">
<label id="search-label">LOOK FOR IT</label> <span id="search-label">Look for it</span>
<img id="search-icon" class="button-icon" src="assets/images/global/icon-search.svg" /> <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="trye">
<use href="assets/images/global/icon-search.svg#search" />
</svg>
</button> </button>
@csrf @csrf
</form> </form>