Skip to content

Commit

Permalink
Forms and archives
Browse files Browse the repository at this point in the history
  • Loading branch information
Teemu Suoranta committed Apr 3, 2019
1 parent fd941e1 commit bff050c
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 27 deletions.
4 changes: 1 addition & 3 deletions 404.php
Expand Up @@ -18,9 +18,7 @@

<div class="entry__content">
<p><?php ask_e('404: Page not found description'); ?></p>
<div class="search-form search-form--404">
<?php aucor_starter_search_form('search-form--404'); ?>
</div>
<?php aucor_starter_search_form('search-form--404', ['class' => 'search-form--404']); ?>
</div>

</article><!-- .entry-404 -->
Expand Down
2 changes: 1 addition & 1 deletion assets/last-edited.json
@@ -1,5 +1,5 @@
{
"js": 1554212402153,
"css": 1554229623458,
"css": 1554273648299,
"svg": 1554212257499
}
14 changes: 14 additions & 0 deletions assets/styles/elements/_forms.scss
Expand Up @@ -67,10 +67,24 @@ input[type="submit"] {

.search-form {
display: flex;
max-width: 30rem;
&__input {
flex-grow: 1;
margin-right: .5rem;
}
&__submit {
@include button;
}

// 404 search form
&--404 {
margin: $gap auto 0;
}

// no search results form
&--search-empty {
margin: $gap auto 0;
}

}

6 changes: 6 additions & 0 deletions assets/styles/views/layout/_layout.scss
Expand Up @@ -59,6 +59,12 @@

@include wrap;

.main {
max-width: 40rem;
margin-left: auto;
margin-right: auto;
}

}

}
Expand Down
6 changes: 1 addition & 5 deletions assets/styles/views/templates/_404.scss
Expand Up @@ -2,10 +2,6 @@
# 404
========================================================================== */

.error404 {

}

.entry--404 {

text-align: center;
}
7 changes: 5 additions & 2 deletions assets/styles/views/templates/_search.scss
Expand Up @@ -2,6 +2,9 @@
# Search
========================================================================== */

.search {

.entry--search-empty {
max-width: 40rem;
margin-left: auto;
margin-right: auto;
text-align: center;
}
2 changes: 1 addition & 1 deletion dist/styles/editor-classic.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/styles/editor-classic.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/styles/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/styles/main.css.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions inc/forms/function-search-form.php
Expand Up @@ -30,6 +30,11 @@ function aucor_starter_search_form($id, $args = array()) {
// parse args
$args = wp_parse_args($args, $defaults);

// extend classlist instead of replacing it
if ($defaults['class'] !== $args['class']) {
$args['class'] .= ' ' . $defaults['class'];
}

// create ID for input
$input_id = $id . '-input';

Expand Down
18 changes: 6 additions & 12 deletions search.php
Expand Up @@ -17,27 +17,21 @@

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<?php get_template_part('partials/content/teaser'); ?>

<?php endwhile; ?>
<div class="teaser-container">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content/teaser'); ?>
<?php endwhile; ?>
</div>

<?php aucor_starter_numeric_posts_nav(); ?>

<?php else : ?>

<article class="entry entry--search-empty">

<header class="entry__header">
<h1 class="entry__header__title"><?php ask_e('Search: Nothing found'); ?></h1>
</header><!-- .entry__header -->

<div class="entry__content">
<p><?php ask_e('Search: Nothing found description'); ?></p>
<div class="search-form search-form--search-empty">
<?php aucor_starter_search_form('search-form--search-empty'); ?>
</div>
<?php aucor_starter_search_form('search-form--search-empty', ['class' => 'search-form--search-empty']); ?>
</div>

</article>
Expand Down

0 comments on commit bff050c

Please sign in to comment.